Program: 32149
Project: 32149
Buggy source:
/** 
 * @param databag
 * @param columnConfig
 * @throws ExecException
 */
private void statsNumericalColumnInfo(DataBag databag,ColumnConfig columnConfig) throws ExecException {
  Integer[] binCountPos=new Integer[columnConfig.getBinBoundary().size() + 1];
  Integer[] binCountNeg=new Integer[columnConfig.getBinBoundary().size() + 1];
  Double[] binWeightCountPos=new Double[columnConfig.getBinBoundary().size() + 1];
  Double[] binWeightCountNeg=new Double[columnConfig.getBinBoundary().size() + 1];
  int lastBinIndex=columnConfig.getBinBoundary().size();
  initializeZeroArr(binCountPos);
  initializeZeroArr(binCountNeg);
  initializeZeroArr(binWeightCountPos);
  initializeZeroArr(binWeightCountNeg);
  boolean isMissingValue=false;
  boolean isInvalidValue=false;
  Iterator<Tuple> iterator=databag.iterator();
  while (iterator.hasNext()) {
    isMissingValue=false;
    isInvalidValue=false;
    Tuple element=iterator.next();
    if (element.size() < 4) {
      continue;
    }
    Object value=element.get(1);
    String tag=(String)element.get(2);
    Double weight=(Double)element.get(3);
    double colVal=0.0;
    String str=null;
    if (value == null || StringUtils.isBlank(value.toString())) {
      missingValueCnt++;
      isMissingValue=true;
    }
 else {
      str=StringUtils.trim(value.toString());
      try {
        colVal=Double.parseDouble(str);
      }
 catch (      Exception e) {
        invalidValueCnt++;
        isInvalidValue=true;
      }
    }
    if (isInvalidValue || isMissingValue) {
      if (modelConfig.getPosTags().contains(tag)) {
        increaseInstCnt(binCountPos,lastBinIndex);
        increaseInstCnt(binWeightCountPos,lastBinIndex,weight);
      }
 else       if (modelConfig.getNegTags().contains(tag)) {
        increaseInstCnt(binCountNeg,lastBinIndex);
        increaseInstCnt(binWeightCountNeg,lastBinIndex,weight);
      }
    }
 else {
      streamStatsCalculator.addData(colVal);
      int binNum=CommonUtils.getBinNum(columnConfig,str);
      if (modelConfig.getPosTags().contains(tag)) {
        increaseInstCnt(binCountPos,binNum);
        increaseInstCnt(binWeightCountPos,binNum,weight);
      }
 else       if (modelConfig.getNegTags().contains(tag)) {
        increaseInstCnt(binCountNeg,binNum);
        increaseInstCnt(binWeightCountNeg,binNum,weight);
      }
    }
  }
  columnConfig.setBinCountPos(Arrays.asList(binCountPos));
  columnConfig.setBinCountNeg(Arrays.asList(binCountNeg));
  columnConfig.setBinWeightedPos(Arrays.asList(binWeightCountPos));
  columnConfig.setBinWeightedNeg(Arrays.asList(binWeightCountNeg));
  columnConfig.setMax(streamStatsCalculator.getMax());
  columnConfig.setMean(streamStatsCalculator.getMean());
  columnConfig.setMin(streamStatsCalculator.getMin());
  columnConfig.setMedian(streamStatsCalculator.getMedian());
  columnConfig.setStdDev(streamStatsCalculator.getStdDev());
  columnConfig.setMissingCnt(missingValueCnt + invalidValueCnt);
  columnConfig.setTotalCount(databag.size());
  columnConfig.setMissingPercentage(((double)columnConfig.getMissingCount()) / columnConfig.getTotalCount());
  calculateBinPosRateAndAvgScore();
}

Fixed version (ground truth):
/** 
 * @param databag
 * @param columnConfig
 * @throws ExecException
 */
private void statsNumericalColumnInfo(DataBag databag,ColumnConfig columnConfig) throws ExecException {
  Integer[] binCountPos=new Integer[columnConfig.getBinBoundary().size() + 1];
  Integer[] binCountNeg=new Integer[columnConfig.getBinBoundary().size() + 1];
  Double[] binWeightCountPos=new Double[columnConfig.getBinBoundary().size() + 1];
  Double[] binWeightCountNeg=new Double[columnConfig.getBinBoundary().size() + 1];
  int lastBinIndex=columnConfig.getBinBoundary().size();
  initializeZeroArr(binCountPos);
  initializeZeroArr(binCountNeg);
  initializeZeroArr(binWeightCountPos);
  initializeZeroArr(binWeightCountNeg);
  boolean isMissingValue=false;
  boolean isInvalidValue=false;
  Iterator<Tuple> iterator=databag.iterator();
  while (iterator.hasNext()) {
    isMissingValue=false;
    isInvalidValue=false;
    Tuple element=iterator.next();
    if (element.size() < 4) {
      continue;
    }
    Object value=element.get(1);
    String tag=(String)element.get(2);
    Double weight=(Double)element.get(3);
    double colVal=0.0;
    String str=null;
    if (value == null || StringUtils.isBlank(value.toString())) {
      missingValueCnt++;
      isMissingValue=true;
    }
 else {
      str=StringUtils.trim(value.toString());
      try {
        colVal=Double.parseDouble(str);
      }
 catch (      Exception e) {
        invalidValueCnt++;
        isInvalidValue=true;
      }
    }
    if (isInvalidValue || isMissingValue) {
      if (modelConfig.getPosTags().contains(tag)) {
        increaseInstCnt(binCountPos,lastBinIndex);
        increaseInstCnt(binWeightCountPos,lastBinIndex,weight);
      }
 else       if (modelConfig.getNegTags().contains(tag)) {
        increaseInstCnt(binCountNeg,lastBinIndex);
        increaseInstCnt(binWeightCountNeg,lastBinIndex,weight);
      }
    }
 else {
      streamStatsCalculator.addData(colVal);
      int binNum=CommonUtils.getBinNum(columnConfig,str);
      if (binNum == -1) {
        throw new RuntimeException("String_Node_Str");
      }
      if (modelConfig.getPosTags().contains(tag)) {
        increaseInstCnt(binCountPos,binNum);
        increaseInstCnt(binWeightCountPos,binNum,weight);
      }
 else       if (modelConfig.getNegTags().contains(tag)) {
        increaseInstCnt(binCountNeg,binNum);
        increaseInstCnt(binWeightCountNeg,binNum,weight);
      }
    }
  }
  columnConfig.setBinCountPos(Arrays.asList(binCountPos));
  columnConfig.setBinCountNeg(Arrays.asList(binCountNeg));
  columnConfig.setBinWeightedPos(Arrays.asList(binWeightCountPos));
  columnConfig.setBinWeightedNeg(Arrays.asList(binWeightCountNeg));
  columnConfig.setMax(streamStatsCalculator.getMax());
  columnConfig.setMean(streamStatsCalculator.getMean());
  columnConfig.setMin(streamStatsCalculator.getMin());
  columnConfig.setMedian(streamStatsCalculator.getMedian());
  columnConfig.setStdDev(streamStatsCalculator.getStdDev());
  columnConfig.setMissingCnt(missingValueCnt + invalidValueCnt);
  columnConfig.setTotalCount(databag.size());
  columnConfig.setMissingPercentage(((double)columnConfig.getMissingCount()) / columnConfig.getTotalCount());
  calculateBinPosRateAndAvgScore();
}