Program: 65348
Project: 65348
Buggy source:
/** 
 * Creates instance of default value chart according to specified chart type.
 * @param cm
 * @return chart instance with default values.
 */
public static Chart createDefaultValueChartInstance(Chart cm){
  Chart instance=getDefaultValueChart(cm).copyInstance();
  SeriesDefinition sd=ChartUtil.getOrthogonalSeriesDefinitions(instance,0).get(0);
  List<Series> seriesList=sd.getSeries();
  seriesList.clear();
  if (instance instanceof ChartWithAxes) {
    seriesList.add(DefaultValueProvider.defBarSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defBubbleSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defScatterSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defDifferenceSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defAreaSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defLineSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defGanttSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defStockSeries().copyInstance());
  }
 else {
    seriesList.add(DefaultValueProvider.defDialSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defPieSeries().copyInstance());
  }
  Set<String> seriesNameSet=new HashSet<String>();
  for (  Series s : seriesList) {
    seriesNameSet.add(s.getClass().getName());
  }
  Set<Series> dtSeries=new HashSet<Series>();
  for (  SeriesDefinition sdef : ChartUtil.getAllOrthogonalSeriesDefinitions(cm)) {
    dtSeries.add(sdef.getDesignTimeSeries());
  }
  for (Iterator<Series> iter=dtSeries.iterator(); iter.hasNext(); ) {
    Series s=iter.next();
    if (!seriesNameSet.contains(s.getClass().getName())) {
      seriesList.add(getDefaultSeries(s));
    }
  }
  instance.getTitle().getLabel().getCaption().setValue(ChartUtil.getDefaultChartTitle(cm));
  return instance;
}

Fixed version (ground truth):
/** 
 * Creates instance of default value chart according to specified chart type.
 * @param cm
 * @return chart instance with default values.
 */
public static Chart createDefaultValueChartInstance(Chart cm){
  Chart instance=getDefaultValueChart(cm).copyInstance();
  SeriesDefinition sd=ChartUtil.getOrthogonalSeriesDefinitions(instance,0).get(0);
  List<Series> seriesList=sd.getSeries();
  seriesList.clear();
  if (instance instanceof ChartWithAxes) {
    seriesList.add(DefaultValueProvider.defBarSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defBubbleSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defScatterSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defDifferenceSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defAreaSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defLineSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defGanttSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defStockSeries().copyInstance());
  }
 else {
    seriesList.add(DefaultValueProvider.defDialSeries().copyInstance());
    seriesList.add(DefaultValueProvider.defPieSeries().copyInstance());
  }
  Set<String> seriesNameSet=new HashSet<String>();
  for (  Series s : seriesList) {
    seriesNameSet.add(s.getClass().getName());
  }
  Set<Series> dtSeries=new HashSet<Series>();
  for (  SeriesDefinition sdef : ChartUtil.getAllOrthogonalSeriesDefinitions(cm)) {
    for (    Series s : sdef.getSeries()) {
      dtSeries.add(s);
    }
  }
  for (Iterator<Series> iter=dtSeries.iterator(); iter.hasNext(); ) {
    Series s=iter.next();
    if (!seriesNameSet.contains(s.getClass().getName())) {
      seriesList.add(getDefaultSeries(s));
    }
  }
  instance.getTitle().getLabel().getCaption().setValue(ChartUtil.getDefaultChartTitle(cm));
  return instance;
}