Program: 79007
Project: 79007
Buggy source:
private Chart getConvertedChart(Chart currentChart,String sNewSubType,String sNewDimension){
  Chart helperModel=(Chart)EcoreUtil.copy(currentChart);
  if (currentChart instanceof ChartWithAxes) {
    currentChart=DialChartImpl.create();
    currentChart.setType(TYPE_LITERAL);
    currentChart.setSubType(sNewSubType);
    currentChart.setDimension(getDimensionFor(sNewDimension));
    currentChart.setBlock(helperModel.getBlock());
    currentChart.setDescription(helperModel.getDescription());
    currentChart.setGridColumnCount(helperModel.getGridColumnCount());
    if (!currentChart.getType().equals(LineChart.TYPE_LITERAL) && !currentChart.getType().equals(PieChart.TYPE_LITERAL) && !currentChart.getType().equals(BarChart.TYPE_LITERAL)&& !currentChart.getType().equals(AreaChart.TYPE_LITERAL)) {
      currentChart.setSampleData(getConvertedSampleData(helperModel.getSampleData()));
    }
    currentChart.setScript(helperModel.getScript());
    currentChart.setUnits(helperModel.getUnits());
    if (helperModel.getGridColumnCount() > 0) {
      currentChart.setGridColumnCount(helperModel.getGridColumnCount());
    }
 else {
      currentChart.setGridColumnCount(1);
    }
    ((ChartWithoutAxes)currentChart).getSeriesDefinitions().add(((Axis)((ChartWithAxes)helperModel).getAxes().get(0)).getSeriesDefinitions().get(0));
    Vector vOSD=new Vector();
    EList axesOrthogonal=((Axis)((ChartWithAxes)helperModel).getAxes().get(0)).getAssociatedAxes();
    for (int i=0; i < axesOrthogonal.size(); i++) {
      EList osd=((Axis)axesOrthogonal.get(i)).getSeriesDefinitions();
      for (int j=0; j < osd.size(); j++) {
        SeriesDefinition sd=(SeriesDefinition)osd.get(j);
        Series series=sd.getDesignTimeSeries();
        sd.getSeries().clear();
        sd.getSeries().add(getConvertedSeries(series));
        vOSD.add(sd);
      }
    }
    ((SeriesDefinition)((ChartWithoutAxes)currentChart).getSeriesDefinitions().get(0)).getSeriesDefinitions().clear();
    ((SeriesDefinition)((ChartWithoutAxes)currentChart).getSeriesDefinitions().get(0)).getSeriesDefinitions().addAll(vOSD);
    currentChart.getLegend().setItemType(LegendItemType.SERIES_LITERAL);
  }
 else   if (currentChart instanceof ChartWithoutAxes) {
    if (currentChart.getType().equals(TYPE_LITERAL)) {
      currentChart.setSubType(sNewSubType);
      ((DialChart)currentChart).setDialSuperimposition(sNewSubType.equals("String_Node_Str"));
      if (!currentChart.getDimension().equals(getDimensionFor(sNewDimension))) {
        currentChart.setDimension(getDimensionFor(sNewDimension));
      }
    }
 else {
      currentChart=DialChartImpl.create();
      currentChart.setType(TYPE_LITERAL);
      currentChart.setSubType(sNewSubType);
      currentChart.setDimension(getDimensionFor(sNewDimension));
      ((DialChart)currentChart).setDialSuperimposition(sNewSubType.equals("String_Node_Str"));
      currentChart.setBlock(helperModel.getBlock());
      currentChart.setDescription(helperModel.getDescription());
      currentChart.setGridColumnCount(helperModel.getGridColumnCount());
      currentChart.setSampleData(helperModel.getSampleData());
      currentChart.setScript(helperModel.getScript());
      currentChart.setUnits(helperModel.getUnits());
      ((ChartWithoutAxes)currentChart).getSeriesDefinitions().clear();
      ((ChartWithoutAxes)currentChart).getSeriesDefinitions().add(((ChartWithoutAxes)helperModel).getSeriesDefinitions().get(0));
      EList seriesdefinitions=((SeriesDefinition)((ChartWithoutAxes)currentChart).getSeriesDefinitions().get(0)).getSeriesDefinitions();
      Series series;
      for (int j=0; j < seriesdefinitions.size(); j++) {
        series=((SeriesDefinition)seriesdefinitions.get(j)).getDesignTimeSeries();
        series=getConvertedSeries(series);
        ((SeriesDefinition)seriesdefinitions.get(j)).getSeries().clear();
        ((SeriesDefinition)seriesdefinitions.get(j)).getSeries().add(series);
      }
      currentChart.getLegend().setItemType(LegendItemType.SERIES_LITERAL);
    }
  }
 else {
    return null;
  }
  return currentChart;
}

Fixed version (ground truth):
private Chart getConvertedChart(Chart currentChart,String sNewSubType,String sNewDimension){
  Chart helperModel=(Chart)EcoreUtil.copy(currentChart);
  if (currentChart instanceof ChartWithAxes) {
    currentChart=DialChartImpl.create();
    currentChart.setType(TYPE_LITERAL);
    currentChart.setSubType(sNewSubType);
    currentChart.setDimension(getDimensionFor(sNewDimension));
    currentChart.setBlock(helperModel.getBlock());
    currentChart.setDescription(helperModel.getDescription());
    currentChart.setGridColumnCount(helperModel.getGridColumnCount());
    if (!currentChart.getType().equals(LineChart.TYPE_LITERAL) && !currentChart.getType().equals(PieChart.TYPE_LITERAL) && !currentChart.getType().equals(BarChart.TYPE_LITERAL)&& !currentChart.getType().equals(AreaChart.TYPE_LITERAL)) {
      currentChart.setSampleData(getConvertedSampleData(helperModel.getSampleData()));
    }
    currentChart.getTitle().getLabel().getCaption().setValue(CHART_TITLE);
    currentChart.setScript(helperModel.getScript());
    currentChart.setUnits(helperModel.getUnits());
    if (helperModel.getGridColumnCount() > 0) {
      currentChart.setGridColumnCount(helperModel.getGridColumnCount());
    }
 else {
      currentChart.setGridColumnCount(1);
    }
    ((ChartWithoutAxes)currentChart).getSeriesDefinitions().add(((Axis)((ChartWithAxes)helperModel).getAxes().get(0)).getSeriesDefinitions().get(0));
    Vector vOSD=new Vector();
    EList axesOrthogonal=((Axis)((ChartWithAxes)helperModel).getAxes().get(0)).getAssociatedAxes();
    for (int i=0; i < axesOrthogonal.size(); i++) {
      EList osd=((Axis)axesOrthogonal.get(i)).getSeriesDefinitions();
      for (int j=0; j < osd.size(); j++) {
        SeriesDefinition sd=(SeriesDefinition)osd.get(j);
        Series series=sd.getDesignTimeSeries();
        sd.getSeries().clear();
        sd.getSeries().add(getConvertedSeries(series));
        vOSD.add(sd);
      }
    }
    ((SeriesDefinition)((ChartWithoutAxes)currentChart).getSeriesDefinitions().get(0)).getSeriesDefinitions().clear();
    ((SeriesDefinition)((ChartWithoutAxes)currentChart).getSeriesDefinitions().get(0)).getSeriesDefinitions().addAll(vOSD);
    currentChart.getLegend().setItemType(LegendItemType.SERIES_LITERAL);
  }
 else   if (currentChart instanceof ChartWithoutAxes) {
    if (currentChart.getType().equals(TYPE_LITERAL)) {
      currentChart.setSubType(sNewSubType);
      ((DialChart)currentChart).setDialSuperimposition(sNewSubType.equals("String_Node_Str"));
      if (!currentChart.getDimension().equals(getDimensionFor(sNewDimension))) {
        currentChart.setDimension(getDimensionFor(sNewDimension));
      }
    }
 else {
      currentChart=DialChartImpl.create();
      currentChart.setType(TYPE_LITERAL);
      currentChart.setSubType(sNewSubType);
      currentChart.setDimension(getDimensionFor(sNewDimension));
      ((DialChart)currentChart).setDialSuperimposition(sNewSubType.equals("String_Node_Str"));
      currentChart.setBlock(helperModel.getBlock());
      currentChart.setDescription(helperModel.getDescription());
      currentChart.setGridColumnCount(helperModel.getGridColumnCount());
      currentChart.setSampleData(helperModel.getSampleData());
      currentChart.setScript(helperModel.getScript());
      currentChart.setUnits(helperModel.getUnits());
      ((ChartWithoutAxes)currentChart).getSeriesDefinitions().clear();
      ((ChartWithoutAxes)currentChart).getSeriesDefinitions().add(((ChartWithoutAxes)helperModel).getSeriesDefinitions().get(0));
      EList seriesdefinitions=((SeriesDefinition)((ChartWithoutAxes)currentChart).getSeriesDefinitions().get(0)).getSeriesDefinitions();
      Series series;
      for (int j=0; j < seriesdefinitions.size(); j++) {
        series=((SeriesDefinition)seriesdefinitions.get(j)).getDesignTimeSeries();
        series=getConvertedSeries(series);
        ((SeriesDefinition)seriesdefinitions.get(j)).getSeries().clear();
        ((SeriesDefinition)seriesdefinitions.get(j)).getSeries().add(series);
      }
      currentChart.getLegend().setItemType(LegendItemType.SERIES_LITERAL);
      currentChart.getTitle().getLabel().getCaption().setValue(CHART_TITLE);
    }
  }
 else {
    return null;
  }
  return currentChart;
}