Program: 65920
Project: 65920
Buggy source:
private Chart getConvertedChart(Chart currentChart,String sNewSubType,Orientation newOrientation,String sNewDimension){
  Chart helperModel=currentChart.copyInstance();
  helperModel.eAdapters().addAll(currentChart.eAdapters());
  ChartCacheManager.getInstance().cacheSeries(ChartUIUtil.getAllOrthogonalSeriesDefinitions(helperModel));
  IChartType oldType=ChartUIUtil.getChartType(currentChart.getType());
  if ((currentChart instanceof ChartWithAxes)) {
    if (currentChart.getType().equals(TYPE_LITERAL)) {
      if (!currentChart.getSubType().equals(sNewSubType)) {
        currentChart.setSubType(sNewSubType);
        EList<Axis> axes=((ChartWithAxes)currentChart).getAxes().get(0).getAssociatedAxes();
        for (int i=0; i < axes.size(); i++) {
          axes.get(i).setPercent(false);
          EList<SeriesDefinition> seriesdefinitions=axes.get(i).getSeriesDefinitions();
          for (int j=0; j < seriesdefinitions.size(); j++) {
            Series series=seriesdefinitions.get(j).getDesignTimeSeries();
            series.unsetStacked();
          }
        }
      }
      ChartElementUtil.setEObjectAttribute(currentChart,"String_Node_Str",newOrientation,newOrientation == null);
      return currentChart;
    }
 else     if (currentChart.getType().equals(LineChart.TYPE_LITERAL) || currentChart.getType().equals(AreaChart.TYPE_LITERAL) || currentChart.getType().equals(BarChart.TYPE_LITERAL)|| currentChart.getType().equals(TubeChart.TYPE_LITERAL)|| currentChart.getType().equals(ConeChart.TYPE_LITERAL)|| currentChart.getType().equals(PyramidChart.TYPE_LITERAL)|| currentChart.getType().equals(ScatterChart.TYPE_LITERAL)|| currentChart.getType().equals(StockChart.TYPE_LITERAL)|| currentChart.getType().equals(BubbleChart.TYPE_LITERAL)|| currentChart.getType().equals(DifferenceChart.TYPE_LITERAL)) {
      currentChart.setType(TYPE_LITERAL);
      currentChart.setSubType(sNewSubType);
      Text title=currentChart.getTitle().getLabel().getCaption();
      if (title.getValue() != null && (title.getValue().trim().length() == 0 || title.getValue().trim().equals(oldType.getDefaultTitle().trim()))) {
        title.setValue(getDefaultTitle());
      }
      EList<Axis> axes=((ChartWithAxes)currentChart).getAxes().get(0).getAssociatedAxes();
      for (int i=0, seriesIndex=0; i < axes.size(); i++) {
        axes.get(i).setPercent(false);
        axes.get(i).setType(AxisType.DATE_TIME_LITERAL);
        EList<SeriesDefinition> seriesdefinitions=axes.get(i).getSeriesDefinitions();
        for (int j=0; j < seriesdefinitions.size(); j++) {
          Series series=seriesdefinitions.get(j).getDesignTimeSeries();
          series=getConvertedSeries(series,seriesIndex++);
          series.unsetStacked();
          seriesdefinitions.get(j).getSeries().clear();
          seriesdefinitions.get(j).getSeries().add(series);
        }
      }
      currentChart.setSampleData(getConvertedSampleData(currentChart.getSampleData(),((ChartWithAxes)currentChart).getAxes().get(0).getType(),AxisType.DATE_TIME_LITERAL));
    }
 else {
      return null;
    }
  }
 else {
    currentChart=ChartWithAxesImpl.createDefault();
    copyChartProperties(helperModel,currentChart);
    currentChart.setType(TYPE_LITERAL);
    currentChart.setSubType(sNewSubType);
    ChartElementUtil.setEObjectAttribute(currentChart,"String_Node_Str",newOrientation,newOrientation == null);
    ChartElementUtil.setEObjectAttribute(currentChart,"String_Node_Str",getDimensionFor(sNewDimension),sNewDimension == null);
    Axis xAxis=((ChartWithAxes)currentChart).getAxes().get(0);
    Axis yAxis=xAxis.getAssociatedAxes().get(0);
    currentChart.setSampleData(getConvertedSampleData(currentChart.getSampleData(),((ChartWithAxes)currentChart).getAxes().get(0).getType(),AxisType.DATE_TIME_LITERAL));
{
      xAxis.getSeriesDefinitions().clear();
      xAxis.getSeriesDefinitions().add(((ChartWithoutAxes)helperModel).getSeriesDefinitions().get(0));
      yAxis.getSeriesDefinitions().clear();
      yAxis.getSeriesDefinitions().addAll(xAxis.getSeriesDefinitions().get(0).getSeriesDefinitions());
      Series series=xAxis.getSeriesDefinitions().get(0).getDesignTimeSeries();
      xAxis.getSeriesDefinitions().get(0).getSeries().clear();
      xAxis.getSeriesDefinitions().get(0).getSeries().add(series);
      EList<SeriesDefinition> seriesdefinitions=yAxis.getSeriesDefinitions();
      for (int j=0; j < seriesdefinitions.size(); j++) {
        series=seriesdefinitions.get(j).getDesignTimeSeries();
        series=getConvertedSeries(series,j);
        series.getLabel().unsetVisible();
        series.unsetStacked();
        seriesdefinitions.get(j).getSeries().clear();
        seriesdefinitions.get(j).getSeries().add(series);
      }
    }
    Text title=currentChart.getTitle().getLabel().getCaption();
    if (title.getValue() != null && (title.getValue().trim().length() == 0 || title.getValue().trim().equals(oldType.getDefaultTitle().trim()))) {
      title.setValue(getDefaultTitle());
    }
  }
  ChartElementUtil.setEObjectAttribute(currentChart,"String_Node_Str",newOrientation,newOrientation == null);
  ChartElementUtil.setEObjectAttribute(currentChart,"String_Node_Str",getDimensionFor(sNewDimension),sNewDimension == null);
  ChartUIUtil.updateDefaultAggregations(currentChart);
  return currentChart;
}

Fixed version (ground truth):
private Chart getConvertedChart(Chart currentChart,String sNewSubType,Orientation newOrientation,String sNewDimension){
  Chart helperModel=currentChart.copyInstance();
  helperModel.eAdapters().addAll(currentChart.eAdapters());
  ChartCacheManager.getInstance().cacheSeries(ChartUIUtil.getAllOrthogonalSeriesDefinitions(helperModel));
  IChartType oldType=ChartUIUtil.getChartType(currentChart.getType());
  if ((currentChart instanceof ChartWithAxes)) {
    if (currentChart.getType().equals(TYPE_LITERAL)) {
      if (!currentChart.getSubType().equals(sNewSubType)) {
        currentChart.setSubType(sNewSubType);
        EList<Axis> axes=((ChartWithAxes)currentChart).getAxes().get(0).getAssociatedAxes();
        for (int i=0; i < axes.size(); i++) {
          axes.get(i).setPercent(false);
          EList<SeriesDefinition> seriesdefinitions=axes.get(i).getSeriesDefinitions();
          for (int j=0; j < seriesdefinitions.size(); j++) {
            Series series=seriesdefinitions.get(j).getDesignTimeSeries();
            series.unsetStacked();
          }
        }
      }
      ChartElementUtil.setEObjectAttribute(currentChart,"String_Node_Str",newOrientation,newOrientation == null);
      return currentChart;
    }
 else     if (currentChart.getType().equals(LineChart.TYPE_LITERAL) || currentChart.getType().equals(AreaChart.TYPE_LITERAL) || currentChart.getType().equals(BarChart.TYPE_LITERAL)|| currentChart.getType().equals(TubeChart.TYPE_LITERAL)|| currentChart.getType().equals(ConeChart.TYPE_LITERAL)|| currentChart.getType().equals(PyramidChart.TYPE_LITERAL)|| currentChart.getType().equals(ScatterChart.TYPE_LITERAL)|| currentChart.getType().equals(StockChart.TYPE_LITERAL)|| currentChart.getType().equals(BubbleChart.TYPE_LITERAL)|| currentChart.getType().equals(DifferenceChart.TYPE_LITERAL)) {
      currentChart.setType(TYPE_LITERAL);
      currentChart.setSubType(sNewSubType);
      Text title=currentChart.getTitle().getLabel().getCaption();
      if (title.getValue() != null && (title.getValue().trim().length() == 0 || title.getValue().trim().equals(oldType.getDefaultTitle().trim()))) {
        title.setValue(getDefaultTitle());
      }
      EList<Axis> axes=((ChartWithAxes)currentChart).getAxes().get(0).getAssociatedAxes();
      for (int i=0, seriesIndex=0; i < axes.size(); i++) {
        axes.get(i).setPercent(false);
        axes.get(i).setType(AxisType.DATE_TIME_LITERAL);
        EList<SeriesDefinition> seriesdefinitions=axes.get(i).getSeriesDefinitions();
        for (int j=0; j < seriesdefinitions.size(); j++) {
          Series series=seriesdefinitions.get(j).getDesignTimeSeries();
          series=getConvertedSeries(series,seriesIndex++);
          series.unsetStacked();
          seriesdefinitions.get(j).getSeries().clear();
          seriesdefinitions.get(j).getSeries().add(series);
        }
      }
      currentChart.setSampleData(getConvertedSampleData(currentChart.getSampleData(),((ChartWithAxes)currentChart).getAxes().get(0).getType(),AxisType.DATE_TIME_LITERAL));
    }
 else {
      return null;
    }
  }
 else {
    currentChart=ChartWithAxesImpl.createDefault();
    copyChartProperties(helperModel,currentChart);
    currentChart.setType(TYPE_LITERAL);
    currentChart.setSubType(sNewSubType);
    ChartElementUtil.setEObjectAttribute(currentChart,"String_Node_Str",newOrientation,newOrientation == null);
    ChartElementUtil.setEObjectAttribute(currentChart,"String_Node_Str",getDimensionFor(sNewDimension),sNewDimension == null);
    try {
      ChartElementUtil.setDefaultValue(((ChartWithAxes)currentChart).getAxes().get(0),"String_Node_Str",true);
    }
 catch (    ChartException e) {
    }
    Axis xAxis=((ChartWithAxes)currentChart).getAxes().get(0);
    Axis yAxis=xAxis.getAssociatedAxes().get(0);
    currentChart.setSampleData(getConvertedSampleData(currentChart.getSampleData(),((ChartWithAxes)currentChart).getAxes().get(0).getType(),AxisType.DATE_TIME_LITERAL));
{
      xAxis.getSeriesDefinitions().clear();
      xAxis.getSeriesDefinitions().add(((ChartWithoutAxes)helperModel).getSeriesDefinitions().get(0));
      yAxis.getSeriesDefinitions().clear();
      yAxis.getSeriesDefinitions().addAll(xAxis.getSeriesDefinitions().get(0).getSeriesDefinitions());
      Series series=xAxis.getSeriesDefinitions().get(0).getDesignTimeSeries();
      xAxis.getSeriesDefinitions().get(0).getSeries().clear();
      xAxis.getSeriesDefinitions().get(0).getSeries().add(series);
      EList<SeriesDefinition> seriesdefinitions=yAxis.getSeriesDefinitions();
      for (int j=0; j < seriesdefinitions.size(); j++) {
        series=seriesdefinitions.get(j).getDesignTimeSeries();
        series=getConvertedSeries(series,j);
        series.getLabel().unsetVisible();
        series.unsetStacked();
        seriesdefinitions.get(j).getSeries().clear();
        seriesdefinitions.get(j).getSeries().add(series);
      }
    }
    Text title=currentChart.getTitle().getLabel().getCaption();
    if (title.getValue() != null && (title.getValue().trim().length() == 0 || title.getValue().trim().equals(oldType.getDefaultTitle().trim()))) {
      title.setValue(getDefaultTitle());
    }
  }
  ChartElementUtil.setEObjectAttribute(currentChart,"String_Node_Str",newOrientation,newOrientation == null);
  ChartElementUtil.setEObjectAttribute(currentChart,"String_Node_Str",getDimensionFor(sNewDimension),sNewDimension == null);
  ChartUIUtil.updateDefaultAggregations(currentChart);
  return currentChart;
}