Program: 140462
Project: 140462
Buggy source:
private static ChartDataEntity[] getDataEnityFromUnits(List<IndicatorUnit> unitList){
  List<ChartDataEntity> list=new ArrayList<ChartDataEntity>();
  for (  IndicatorUnit unit : unitList) {
    if (unit.getType() == IndicatorEnum.FrequencyIndicatorEnum) {
      FrequencyExt[] freqExt=(FrequencyExt[])unit.getValue();
      for (      FrequencyExt one : freqExt) {
        ChartDataEntity entity=new ChartDataEntity();
        entity.setLabel(one.getKey().toString());
        entity.setValue(String.valueOf(one.getValue()));
        entity.setPercent(String.valueOf(one.getFrequency()));
        entity.setIndicator(unit.getIndicator());
        list.add(entity);
      }
      ChartDataEntity 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);
    }
 else     if (unit.getType() == IndicatorEnum.RegexpMatchingIndicatorEnum || unit.getType() == IndicatorEnum.SqlPatternMatchingIndicatorEnum) {
      PatternMatchingExt patnExt=(PatternMatchingExt)unit.getValue();
      PatternChartDataEntity entity=new PatternChartDataEntity();
      entity.setLabel(unit.getIndicatorName());
      entity.setNumMatch(String.valueOf(patnExt.getMatchingValueCount()));
      entity.setNumNoMatch(String.valueOf(patnExt.getNotMatchingValueCount()));
      entity.setIndicator(unit.getIndicator());
      list.add(entity);
    }
 else {
      if (unit.getValue() != null) {
        ChartDataEntity 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(one.getKey().toString());
        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();
PatternChartDataEntity patternEntity=new PatternChartDataEntity();
patternEntity.setLabel(unit.getIndicatorName());
patternEntity.setNumMatch(String.valueOf(patnExt.getMatchingValueCount()));
patternEntity.setNumNoMatch(String.valueOf(patnExt.getNotMatchingValueCount()));
patternEntity.setIndicator(unit.getIndicator());
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()]);
}