Program: 140267
Project: 140267
Buggy source:
private static ChartDataEntity[] getDataEnityFromUnits(List<IndicatorUnit> unitList){
  List<ChartDataEntity> list=new ArrayList<ChartDataEntity>();
  for (  IndicatorUnit unit : unitList) {
    if (unit.isExcuted()) {
      ChartDataEntity entity;
switch (unit.getType()) {
case FrequencyIndicatorEnum:
        FrequencyExt[] freqExt=(FrequencyExt[])unit.getValue();
      for (      FrequencyExt one : freqExt) {
        entity=new ChartDataEntity();
        entity.setLabel(String.valueOf(one.getKey()));
        entity.setValue(String.valueOf(one.getValue()));
        entity.setPercent(String.valueOf(one.getFrequency()));
        entity.setIndicator(unit.getIndicator());
        list.add(entity);
      }
    entity=new ChartDataEntity();
  FrequencyIndicator freqIndicator=(FrequencyIndicator)unit.getIndicator();
entity.setLabel(FrequencyIndicator.OTHER);
entity.setValue(freqIndicator.getCount(FrequencyIndicator.OTHER).toString());
entity.setPercent(freqIndicator.getFrequency(FrequencyIndicator.OTHER).toString());
entity.setIndicator(freqIndicator);
list.add(entity);
break;
case RegexpMatchingIndicatorEnum:
case SqlPatternMatchingIndicatorEnum:
PatternMatchingExt patnExt=(PatternMatchingExt)unit.getValue();
PatternMatchingIndicator patternIndicator=(PatternMatchingIndicator)unit.getIndicator();
PatternChartDataEntity patternEntity=new PatternChartDataEntity();
patternEntity.setLabel(unit.getIndicatorName());
patternEntity.setNumMatch(String.valueOf(patnExt.getMatchingValueCount()));
patternEntity.setNumNoMatch(String.valueOf(patnExt.getNotMatchingValueCount()));
Double total=patternIndicator.getMatchingValueCount().doubleValue() + patternIndicator.getNotMatchingValueCount().doubleValue();
Double percentMatch=total > 0 ? patternIndicator.getMatchingValueCount().doubleValue() * 100 / total : Double.NaN;
patternEntity.setValue(String.valueOf(percentMatch));
patternEntity.setIndicator(patternIndicator);
list.add(patternEntity);
break;
default :
entity=new ChartDataEntity();
entity.setLabel(unit.getIndicatorName());
entity.setValue(unit.getValue().toString());
entity.setIndicator(unit.getIndicator());
list.add(entity);
}
}
}
return list.toArray(new ChartDataEntity[list.size()]);
}

Fixed version (ground truth):
private static ChartDataEntity[] getDataEnityFromUnits(List<IndicatorUnit> unitList){
  List<ChartDataEntity> list=new ArrayList<ChartDataEntity>();
  for (  IndicatorUnit unit : unitList) {
    if (unit.isExcuted()) {
      ChartDataEntity entity;
switch (unit.getType()) {
case FrequencyIndicatorEnum:
        FrequencyExt[] freqExt=(FrequencyExt[])unit.getValue();
      for (      FrequencyExt one : freqExt) {
        entity=new ChartDataEntity();
        entity.setLabel(String.valueOf(one.getKey()));
        entity.setValue(String.valueOf(one.getValue()));
        entity.setPercent(String.valueOf(one.getFrequency()));
        entity.setIndicator(unit.getIndicator());
        list.add(entity);
      }
    entity=new ChartDataEntity();
  FrequencyIndicator freqIndicator=(FrequencyIndicator)unit.getIndicator();
entity.setLabel(FrequencyIndicator.OTHER);
entity.setValue(freqIndicator.getCount(FrequencyIndicator.OTHER).toString());
entity.setPercent(freqIndicator.getFrequency(FrequencyIndicator.OTHER).toString());
entity.setIndicator(freqIndicator);
list.add(entity);
break;
case RegexpMatchingIndicatorEnum:
case SqlPatternMatchingIndicatorEnum:
PatternMatchingExt patnExt=(PatternMatchingExt)unit.getValue();
PatternMatchingIndicator patternIndicator=(PatternMatchingIndicator)unit.getIndicator();
PatternChartDataEntity patternEntity=new PatternChartDataEntity();
patternEntity.setLabel(unit.getIndicatorName());
patternEntity.setNumMatch(String.valueOf(patnExt.getMatchingValueCount()));
patternEntity.setNumNoMatch(String.valueOf(patnExt.getNotMatchingValueCount()));
Double total=patternIndicator.getMatchingValueCount().doubleValue() + patternIndicator.getNotMatchingValueCount().doubleValue();
Double percentMatch=total > 0 ? patternIndicator.getMatchingValueCount().doubleValue() * 100 / total : Double.NaN;
patternEntity.setValue(String.valueOf(percentMatch));
patternEntity.setIndicator(patternIndicator);
list.add(patternEntity);
break;
default :
entity=new ChartDataEntity();
entity.setLabel(unit.getIndicatorName());
entity.setValue(String.valueOf(unit.getValue()));
entity.setIndicator(unit.getIndicator());
list.add(entity);
}
}
}
return list.toArray(new ChartDataEntity[list.size()]);
}