Program: 140215
Project: 140215
Buggy source:
static IDataEntity createDataset(EIndicatorChartType chartType,List<IndicatorUnit> indicatorUnitList){
  CustomerDataset dataset=new CustomerDataset();
  for (int index=0; index < indicatorUnitList.size(); index++) {
    IndicatorUnit unit=indicatorUnitList.get(index);
    IndicatorCommonUtil.compositeIndicatorMap(unit);
  }
switch (chartType) {
case FREQUENCE_STATISTICS:
    for (    IndicatorUnit unit : indicatorUnitList) {
      if (unit.isExcuted()) {
        FrequencyExt[] frequencyExt=(FrequencyExt[])unit.getValue();
        Arrays.sort(frequencyExt);
        int numOfShown=frequencyExt.length;
        IndicatorParameters parameters=unit.getIndicator().getParameters();
        if (parameters != null) {
          if (parameters.getTopN() < frequencyExt.length) {
            numOfShown=parameters.getTopN();
          }
        }
        for (int i=0; i < numOfShown; i++) {
          dataset.addValue(frequencyExt[i].getValue(),"String_Node_Str",String.valueOf(frequencyExt[i].getKey()));
          ChartDataEntity entity=new ChartDataEntity();
          entity.setIndicator(unit.getIndicator());
          entity.setLabel(String.valueOf(frequencyExt[i].getKey()));
          entity.setValue(String.valueOf(frequencyExt[i].getValue()));
          dataset.addDataEntity(entity);
        }
      }
    }
  break;
case SQL_PATTERN_MATCHING:
case PATTERN_MATCHING:
for (IndicatorUnit unit : indicatorUnitList) {
  if (unit.isExcuted()) {
    String label=unit.getIndicatorName();
    PatternMatchingExt patternExt=(PatternMatchingExt)unit.getValue();
    double notMathCount=patternExt.getNotMatchingValueCount();
    double machCount=patternExt.getMatchingValueCount();
    dataset.addValue(machCount,"String_Node_Str",label);
    dataset.addValue(notMathCount,"String_Node_Str",label);
    PatternChartDataEntity patternEntity=new PatternChartDataEntity();
    patternEntity.setIndicator(unit.getIndicator());
    patternEntity.setLabel(unit.getIndicatorName());
    patternEntity.setNumMatch(String.valueOf(machCount));
    patternEntity.setNumNoMatch(String.valueOf(notMathCount));
    dataset.addDataEntity(patternEntity);
  }
}
break;
case TEXT_STATISTICS:
ComparatorsFactory.sort(indicatorUnitList,ComparatorsFactory.TEXT_STATISTICS_COMPARATOR_ID);
case SIMPLE_STATISTICS:
for (IndicatorUnit unit : indicatorUnitList) {
if (unit.isExcuted()) {
double value=Double.parseDouble(unit.getValue().toString());
String label=unit.getIndicatorName();
dataset.addValue(value,label,"String_Node_Str");
ChartDataEntity entity=new ChartDataEntity();
entity.setIndicator(unit.getIndicator());
entity.setLabel(label);
entity.setValue(String.valueOf(value));
dataset.addDataEntity(entity);
}
}
break;
case SUMMARY_STATISTICS:
CustomerBoxDataset defaultDataset=new CustomerBoxDataset();
Map<IndicatorEnum,Double> map=new HashMap<IndicatorEnum,Double>();
for (IndicatorUnit unit : indicatorUnitList) {
if (unit.isExcuted()) {
double doubleValue=Double.parseDouble(unit.getValue().toString());
map.put(unit.getType(),doubleValue);
ChartDataEntity entity=new ChartDataEntity();
entity.setIndicator(unit.getIndicator());
entity.setLabel(unit.getIndicatorName());
entity.setValue(String.valueOf(unit.getValue()));
dataset.addDataEntity(entity);
defaultDataset.addDataEntity(entity);
}
}
if (map.size() != 6) {
for (IndicatorEnum indicatorEnum : map.keySet()) {
dataset.addValue(map.get(indicatorEnum),"String_Node_Str",indicatorEnum.getLabel());
}
}
 else {
BoxAndWhiskerItem item=createBoxAndWhiskerItem(map.get(IndicatorEnum.MeanIndicatorEnum),map.get(IndicatorEnum.MedianIndicatorEnum),map.get(IndicatorEnum.LowerQuartileIndicatorEnum),map.get(IndicatorEnum.UpperQuartileIndicatorEnum),map.get(IndicatorEnum.MinValueIndicatorEnum),map.get(IndicatorEnum.MaxValueIndicatorEnum),null);
defaultDataset.add(item,"String_Node_Str","String_Node_Str");
return defaultDataset;
}
default :
return null;
}
return dataset;
}

Fixed version (ground truth):
static IDataEntity createDataset(EIndicatorChartType chartType,List<IndicatorUnit> indicatorUnitList){
  CustomerDataset dataset=new CustomerDataset();
  for (int index=0; index < indicatorUnitList.size(); index++) {
    IndicatorUnit unit=indicatorUnitList.get(index);
    IndicatorCommonUtil.compositeIndicatorMap(unit);
  }
switch (chartType) {
case FREQUENCE_STATISTICS:
    for (    IndicatorUnit unit : indicatorUnitList) {
      if (unit.isExcuted()) {
        FrequencyExt[] frequencyExt=(FrequencyExt[])unit.getValue();
        Arrays.sort(frequencyExt);
        int numOfShown=frequencyExt.length;
        IndicatorParameters parameters=unit.getIndicator().getParameters();
        if (parameters != null) {
          if (parameters.getTopN() < frequencyExt.length) {
            numOfShown=parameters.getTopN();
          }
        }
        for (int i=0; i < numOfShown; i++) {
          dataset.addValue(frequencyExt[i].getValue(),"String_Node_Str",String.valueOf(frequencyExt[i].getKey()));
          ChartDataEntity entity=new ChartDataEntity();
          entity.setIndicator(unit.getIndicator());
          entity.setLabel(String.valueOf(frequencyExt[i].getKey()));
          entity.setValue(String.valueOf(frequencyExt[i].getValue()));
          entity.setPercent(String.valueOf(frequencyExt[i].getFrequency()));
          dataset.addDataEntity(entity);
        }
      }
    }
  break;
case SQL_PATTERN_MATCHING:
case PATTERN_MATCHING:
for (IndicatorUnit unit : indicatorUnitList) {
  if (unit.isExcuted()) {
    String label=unit.getIndicatorName();
    PatternMatchingExt patternExt=(PatternMatchingExt)unit.getValue();
    double notMathCount=patternExt.getNotMatchingValueCount();
    double machCount=patternExt.getMatchingValueCount();
    dataset.addValue(machCount,"String_Node_Str",label);
    dataset.addValue(notMathCount,"String_Node_Str",label);
    PatternChartDataEntity patternEntity=new PatternChartDataEntity();
    patternEntity.setIndicator(unit.getIndicator());
    patternEntity.setLabel(unit.getIndicatorName());
    patternEntity.setNumMatch(String.valueOf(machCount));
    patternEntity.setNumNoMatch(String.valueOf(notMathCount));
    dataset.addDataEntity(patternEntity);
  }
}
break;
case TEXT_STATISTICS:
ComparatorsFactory.sort(indicatorUnitList,ComparatorsFactory.TEXT_STATISTICS_COMPARATOR_ID);
case SIMPLE_STATISTICS:
for (IndicatorUnit unit : indicatorUnitList) {
if (unit.isExcuted()) {
double value=Double.parseDouble(unit.getValue().toString());
String label=unit.getIndicatorName();
dataset.addValue(value,label,"String_Node_Str");
ChartDataEntity entity=new ChartDataEntity();
entity.setIndicator(unit.getIndicator());
entity.setLabel(label);
entity.setValue(String.valueOf(value));
entity.setPercent(String.valueOf(value / unit.getIndicator().getCount()));
dataset.addDataEntity(entity);
}
}
break;
case MODE_INDICATOR:
for (IndicatorUnit unit : indicatorUnitList) {
if (unit.isExcuted()) {
String label=unit.getIndicatorName();
ChartDataEntity entity=new ChartDataEntity();
entity.setIndicator(unit.getIndicator());
entity.setLabel(label);
entity.setValue(unit.getValue().toString());
dataset.addDataEntity(entity);
}
}
break;
case SUMMARY_STATISTICS:
CustomerBoxDataset defaultDataset=new CustomerBoxDataset();
Map<IndicatorEnum,Double> map=new HashMap<IndicatorEnum,Double>();
for (IndicatorUnit unit : indicatorUnitList) {
if (unit.isExcuted()) {
double doubleValue=Double.parseDouble(unit.getValue().toString());
map.put(unit.getType(),doubleValue);
ChartDataEntity entity=new ChartDataEntity();
entity.setIndicator(unit.getIndicator());
entity.setLabel(unit.getIndicatorName());
entity.setValue(String.valueOf(unit.getValue()));
dataset.addDataEntity(entity);
defaultDataset.addDataEntity(entity);
}
}
if (map.size() != 6) {
for (IndicatorEnum indicatorEnum : map.keySet()) {
dataset.addValue(map.get(indicatorEnum),"String_Node_Str",indicatorEnum.getLabel());
}
}
 else {
BoxAndWhiskerItem item=createBoxAndWhiskerItem(map.get(IndicatorEnum.MeanIndicatorEnum),map.get(IndicatorEnum.MedianIndicatorEnum),map.get(IndicatorEnum.LowerQuartileIndicatorEnum),map.get(IndicatorEnum.UpperQuartileIndicatorEnum),map.get(IndicatorEnum.MinValueIndicatorEnum),map.get(IndicatorEnum.MaxValueIndicatorEnum),null);
defaultDataset.add(item,"String_Node_Str","String_Node_Str");
return defaultDataset;
}
default :
return null;
}
return dataset;
}