Program: 137437
Project: 137437
Buggy source:
/** 
 * DOC xqliu Comment method "handleFrequency".
 * @param indicator
 * @return
 */
private static Object handleFrequency(Indicator indicator){
  FrequencyExt[] frequencyExt=null;
  if (UDIHelper.isUDI(indicator)) {
    UserDefIndicator udi=(UserDefIndicator)indicator;
    Set<Object> valueSet=udi.getDistinctValues();
    if (valueSet == null) {
      return null;
    }
    frequencyExt=new FrequencyExt[valueSet.size()];
    int i=0;
    for (    Object o : valueSet) {
      frequencyExt[i]=new FrequencyExt();
      frequencyExt[i].setKey(o);
      frequencyExt[i].setValue(udi.getCount(o));
      frequencyExt[i].setFrequency(udi.getFrequency(o));
      i++;
    }
  }
 else   if (IndicatorEnum.DatePatternFreqIndicatorEnum.getIndicatorType().isInstance(indicator)) {
    DatePatternFreqIndicator datePatternFrequency=(DatePatternFreqIndicator)indicator;
    List<Object> modelMatchers=datePatternFrequency.getRealModelMatcherList();
    frequencyExt=new FrequencyExt[modelMatchers.size()];
    int i=0;
    for (    Object patternMatcher : modelMatchers) {
      frequencyExt[i]=new FrequencyExt();
      frequencyExt[i].setKey(datePatternFrequency.getModel(patternMatcher));
      frequencyExt[i].setValue(Long.valueOf(String.valueOf(datePatternFrequency.getScore(patternMatcher))));
      frequencyExt[i].setFrequency(datePatternFrequency.getFrequency(patternMatcher));
      i++;
    }
  }
 else {
    FrequencyIndicator frequency=(FrequencyIndicator)indicator;
    Set<Object> valueSet=frequency.getDistinctValues();
    if (valueSet == null) {
      return null;
    }
    frequencyExt=new FrequencyExt[valueSet.size()];
    int i=0;
    for (    Object o : valueSet) {
      frequencyExt[i]=new FrequencyExt();
      frequencyExt[i].setKey(o);
      if (IndicatorsPackage.eINSTANCE.getSoundexFreqIndicator().equals(frequency.eClass()) || IndicatorsPackage.eINSTANCE.getSoundexLowFreqIndicator().equals(frequency.eClass())) {
        frequencyExt[i].setValue(((SoundexFreqIndicator)frequency).getDistinctCount(o));
      }
 else {
        frequencyExt[i].setValue(frequency.getCount(o));
      }
      frequencyExt[i].setFrequency(frequency.getFrequency(o));
      i++;
    }
  }
  return frequencyExt;
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "handleFrequency".
 * @param indicator
 * @return
 */
private static Object handleFrequency(Indicator indicator){
  FrequencyExt[] frequencyExt=null;
  if (UDIHelper.isUDI(indicator)) {
    UserDefIndicator udi=(UserDefIndicator)indicator;
    Set<Object> valueSet=udi.getDistinctValues();
    if (valueSet == null) {
      return null;
    }
    frequencyExt=new FrequencyExt[valueSet.size()];
    int i=0;
    for (    Object o : valueSet) {
      frequencyExt[i]=new FrequencyExt();
      frequencyExt[i].setKey(o);
      frequencyExt[i].setValue(udi.getCount(o));
      frequencyExt[i].setFrequency(udi.getFrequency(o));
      i++;
    }
  }
 else   if (IndicatorEnum.DatePatternFreqIndicatorEnum.getIndicatorType().isInstance(indicator)) {
    DatePatternFreqIndicator datePatternFrequency=(DatePatternFreqIndicator)indicator;
    Map<String,Long> results=datePatternFrequency.getResult();
    frequencyExt=new FrequencyExt[results.size()];
    int i=0;
    for (    String key : results.keySet()) {
      Long value=results.get(key);
      Double frequency=datePatternFrequency.getFrequency(key);
      frequencyExt[i]=new FrequencyExt();
      frequencyExt[i].setKey(key);
      frequencyExt[i].setValue(value);
      frequencyExt[i].setFrequency(frequency);
      i++;
    }
  }
 else {
    FrequencyIndicator frequency=(FrequencyIndicator)indicator;
    Set<Object> valueSet=frequency.getDistinctValues();
    if (valueSet == null) {
      return null;
    }
    frequencyExt=new FrequencyExt[valueSet.size()];
    int i=0;
    for (    Object o : valueSet) {
      frequencyExt[i]=new FrequencyExt();
      frequencyExt[i].setKey(o);
      if (IndicatorsPackage.eINSTANCE.getSoundexFreqIndicator().equals(frequency.eClass()) || IndicatorsPackage.eINSTANCE.getSoundexLowFreqIndicator().equals(frequency.eClass())) {
        frequencyExt[i].setValue(((SoundexFreqIndicator)frequency).getDistinctCount(o));
      }
 else {
        frequencyExt[i].setValue(frequency.getCount(o));
      }
      frequencyExt[i].setFrequency(frequency.getFrequency(o));
      i++;
    }
  }
  return frequencyExt;
}