Program: 65928
Project: 65928
Buggy source:
protected void addNewSeriesDefinition(){
  SeriesDefinition sdTmp=SeriesDefinitionImpl.create();
  ChartAdapter.beginIgnoreNotifications();
  if (!seriesDefns.isEmpty()) {
    if (ChartElementUtil.isSetSeriesPalette(getChart())) {
      Palette pa=((seriesDefns.get(0))).getSeriesPalette();
      for (int i=0; i < pa.getEntries().size(); i++) {
        int index=i + seriesDefns.size();
        int paletteSize=pa.getEntries().size();
        while (index >= pa.getEntries().size()) {
          index-=paletteSize;
        }
        sdTmp.getSeriesPalette().getEntries().add(i,pa.getEntries().get(index).copyInstance());
      }
    }
    Series newSeries=seriesDefns.get(0).getDesignTimeSeries().copyInstance();
    newSeries.getTriggers().clear();
    sdTmp.getSeries().add(newSeries);
    sdTmp.setQuery(seriesDefns.get(0).getQuery().copyInstance());
    cleanDataDefinition(sdTmp);
    sdTmp.getDesignTimeSeries().setSeriesIdentifier("String_Node_Str");
    sdTmp.eAdapters().addAll(seriesDefns.get(0).eAdapters());
    int firstIndex=getFirstIndexOfSameAxis();
    EList<OrthogonalSampleData> list=getChart().getSampleData().getOrthogonalSampleData();
    OrthogonalSampleData sdOrthogonal=list.get(firstIndex).copyInstance();
    if (axisIndex == -1) {
      sdOrthogonal.setSeriesDefinitionIndex(seriesDefns.size());
    }
 else {
      sdOrthogonal.setSeriesDefinitionIndex(ChartUIUtil.getLastSeriesIndexWithinAxis(getChart(),axisIndex) + 1);
    }
    sdOrthogonal.setDataSetRepresentation(convertDataSetRepresentation(sdOrthogonal.getDataSetRepresentation(),sdOrthogonal.getSeriesDefinitionIndex()));
    sdOrthogonal.eAdapters().addAll(getChart().getSampleData().eAdapters());
    int sdIndex=sdOrthogonal.getSeriesDefinitionIndex();
    ArrayList<OrthogonalSampleData> al=new ArrayList<OrthogonalSampleData>();
    if (sdIndex >= list.size()) {
      list.add(sdOrthogonal);
    }
 else {
      for (int i=sdIndex; i < list.size(); i++) {
        al.add(list.get(i));
      }
      list.set(sdIndex,sdOrthogonal);
      for (int i=1; i < al.size(); i++) {
        list.set(i + sdIndex,al.get(i - 1));
        list.get(i + sdIndex).setSeriesDefinitionIndex(i + sdIndex);
      }
      list.add(al.get(al.size() - 1));
      list.get(list.size() - 1).setSeriesDefinitionIndex(list.size() - 1);
    }
  }
 else {
    sdTmp.getSeries().add(BarSeriesImpl.create());
    OrthogonalSampleData sampleData=DataFactory.eINSTANCE.createOrthogonalSampleData();
    sampleData.setDataSetRepresentation(ChartUtil.getNewSampleData(AxisType.LINEAR_LITERAL,0));
    sampleData.setSeriesDefinitionIndex(0);
    getChart().getSampleData().getOrthogonalSampleData().add(getFirstIndexOfSameAxis(),sampleData);
  }
  seriesDefns.add(sdTmp);
  ChartAdapter.endIgnoreNotifications();
  ChartUIUtil.setSeriesName(wizardContext.getModel());
}

Fixed version (ground truth):
protected void addNewSeriesDefinition(){
  SeriesDefinition sdTmp=SeriesDefinitionImpl.create();
  ChartAdapter.beginIgnoreNotifications();
  if (!seriesDefns.isEmpty()) {
    if (ChartElementUtil.isSetSeriesPalette(getChart())) {
      Palette pa=((seriesDefns.get(0))).getSeriesPalette();
      for (int i=0; i < pa.getEntries().size(); i++) {
        int index=i + seriesDefns.size();
        int paletteSize=pa.getEntries().size();
        while (index >= pa.getEntries().size()) {
          index-=paletteSize;
        }
        sdTmp.getSeriesPalette().getEntries().add(i,pa.getEntries().get(index).copyInstance());
      }
    }
    Series newSeries=seriesDefns.get(0).getDesignTimeSeries().copyInstance();
    newSeries.getTriggers().clear();
    Action a=ActionImpl.create(ActionType.SHOW_TOOLTIP_LITERAL,TooltipValueImpl.create(200,"String_Node_Str"));
    Trigger e=TriggerImpl.create(TriggerCondition.ONMOUSEOVER_LITERAL,a);
    newSeries.getTriggers().add(e);
    sdTmp.getSeries().add(newSeries);
    sdTmp.setQuery(seriesDefns.get(0).getQuery().copyInstance());
    cleanDataDefinition(sdTmp);
    sdTmp.getDesignTimeSeries().setSeriesIdentifier("String_Node_Str");
    sdTmp.eAdapters().addAll(seriesDefns.get(0).eAdapters());
    int firstIndex=getFirstIndexOfSameAxis();
    EList<OrthogonalSampleData> list=getChart().getSampleData().getOrthogonalSampleData();
    OrthogonalSampleData sdOrthogonal=list.get(firstIndex).copyInstance();
    if (axisIndex == -1) {
      sdOrthogonal.setSeriesDefinitionIndex(seriesDefns.size());
    }
 else {
      sdOrthogonal.setSeriesDefinitionIndex(ChartUIUtil.getLastSeriesIndexWithinAxis(getChart(),axisIndex) + 1);
    }
    sdOrthogonal.setDataSetRepresentation(convertDataSetRepresentation(sdOrthogonal.getDataSetRepresentation(),sdOrthogonal.getSeriesDefinitionIndex()));
    sdOrthogonal.eAdapters().addAll(getChart().getSampleData().eAdapters());
    int sdIndex=sdOrthogonal.getSeriesDefinitionIndex();
    ArrayList<OrthogonalSampleData> al=new ArrayList<OrthogonalSampleData>();
    if (sdIndex >= list.size()) {
      list.add(sdOrthogonal);
    }
 else {
      for (int i=sdIndex; i < list.size(); i++) {
        al.add(list.get(i));
      }
      list.set(sdIndex,sdOrthogonal);
      for (int i=1; i < al.size(); i++) {
        list.set(i + sdIndex,al.get(i - 1));
        list.get(i + sdIndex).setSeriesDefinitionIndex(i + sdIndex);
      }
      list.add(al.get(al.size() - 1));
      list.get(list.size() - 1).setSeriesDefinitionIndex(list.size() - 1);
    }
  }
 else {
    sdTmp.getSeries().add(BarSeriesImpl.create());
    OrthogonalSampleData sampleData=DataFactory.eINSTANCE.createOrthogonalSampleData();
    sampleData.setDataSetRepresentation(ChartUtil.getNewSampleData(AxisType.LINEAR_LITERAL,0));
    sampleData.setSeriesDefinitionIndex(0);
    getChart().getSampleData().getOrthogonalSampleData().add(getFirstIndexOfSameAxis(),sampleData);
  }
  seriesDefns.add(sdTmp);
  ChartAdapter.endIgnoreNotifications();
  ChartUIUtil.setSeriesName(wizardContext.getModel());
}