Program: 66261
Project: 66261
Buggy source:
private ITimePeriod populateBaseTimePeriod(ComputedColumnHandle periodHandle){
  String calculateType=periodHandle.getCalculationType();
  TimePeriod baseTimePeriod=null;
  if (IBuildInBaseTimeFunction.CURRENT_QUARTER.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.QUARTER);
  }
 else   if (IBuildInBaseTimeFunction.CURRENT_MONTH.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.MONTH);
  }
 else   if (IBuildInBaseTimeFunction.TRAILING_30_DAYS.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(-30,TimePeriodType.DAY);
  }
 else   if (IBuildInBaseTimeFunction.TRAILING_60_DAYS.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(-60,TimePeriodType.DAY);
  }
 else   if (IBuildInBaseTimeFunction.TRAILING_90_DAYS.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(-90,TimePeriodType.DAY);
  }
 else   if (IBuildInBaseTimeFunction.TRAILING_12_MONTHS.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(-12,TimePeriodType.MONTH);
  }
 else   if (IBuildInBaseTimeFunction.YEAR_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.YEAR);
  }
 else   if (IBuildInBaseTimeFunction.QUARTER_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.QUARTER);
  }
 else   if (IBuildInBaseTimeFunction.MONTH_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.MONTH);
  }
 else   if (IBuildInBaseTimeFunction.CURRENT_YEAR.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.YEAR);
  }
 else   if (IBuildInBaseTimeFunction.WEEK_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.WEEK);
  }
 else   if (IBuildInBaseTimeFunction.MONTH_TO_DATE_LAST_YEAR.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.MONTH);
  }
 else   if (IBuildInBaseTimeFunction.QUARTER_TO_DATE_LAST_YEAR.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.QUARTER);
  }
 else   if (IBuildInBaseTimeFunction.PREVIOUS_MONTH_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.MONTH);
  }
 else   if (IBuildInBaseTimeFunction.PREVIOUS_QUARTER_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.QUARTER);
  }
 else   if (IBuildInBaseTimeFunction.PREVIOUS_YEAR_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.YEAR);
  }
 else   if (IBuildInBaseTimeFunction.CURRENT_PERIOD_FROM_N_PERIOD_AGO.equals(calculateType) || IBuildInBaseTimeFunction.PERIOD_TO_DATE_FROM_N_PERIOD_AGO.equals(calculateType)) {
    Iterator iter=periodHandle.calculationArgumentsIterator();
    String period1=null;
    while (iter.hasNext()) {
      CalculationArgumentHandle argument=(CalculationArgumentHandle)iter.next();
      if (IArgumentInfo.PERIOD_1.equals(argument.getName())) {
        period1=argument.getValue().getStringExpression();
        break;
      }
    }
    baseTimePeriod=new TimePeriod(0,getTimePeriodType(period1));
  }
 else   if (IBuildInBaseTimeFunction.TRAILING_N_PERIOD_FROM_N_PERIOD_AGO.equals(calculateType)) {
    Iterator iter=periodHandle.calculationArgumentsIterator();
    String period1=null, n=null;
    while (iter.hasNext()) {
      CalculationArgumentHandle argument=(CalculationArgumentHandle)iter.next();
      if (IArgumentInfo.PERIOD_1.equals(argument.getName())) {
        period1=argument.getValue().getStringExpression();
      }
      if (IArgumentInfo.N_PERIOD1.equals(argument.getName())) {
        n=argument.getValue().getStringExpression();
      }
    }
    baseTimePeriod=new TimePeriod(0 - Integer.valueOf(n),getTimePeriodType(period1));
  }
 else   if (IBuildInBaseTimeFunction.NEXT_N_PERIODS.equals(calculateType)) {
    Iterator iter=periodHandle.calculationArgumentsIterator();
    String n=null, period1=null;
    while (iter.hasNext()) {
      CalculationArgumentHandle argument=(CalculationArgumentHandle)iter.next();
      if (IArgumentInfo.PERIOD_1.equals(argument.getName())) {
        period1=argument.getValue().getStringExpression();
      }
      if (IArgumentInfo.N_PERIOD1.equals(argument.getName())) {
        n=argument.getValue().getStringExpression();
        break;
      }
    }
    baseTimePeriod=new TimePeriod(Integer.valueOf(n),getTimePeriodType(period1));
  }
  return baseTimePeriod;
}

Fixed version (ground truth):
private ITimePeriod populateBaseTimePeriod(ComputedColumnHandle periodHandle){
  String calculateType=periodHandle.getCalculationType();
  TimePeriod baseTimePeriod=null;
  if (IBuildInBaseTimeFunction.CURRENT_QUARTER.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.QUARTER);
  }
 else   if (IBuildInBaseTimeFunction.CURRENT_MONTH.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.MONTH);
  }
 else   if (IBuildInBaseTimeFunction.TRAILING_30_DAYS.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(-30,TimePeriodType.DAY);
  }
 else   if (IBuildInBaseTimeFunction.TRAILING_60_DAYS.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(-60,TimePeriodType.DAY);
  }
 else   if (IBuildInBaseTimeFunction.TRAILING_90_DAYS.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(-90,TimePeriodType.DAY);
  }
 else   if (IBuildInBaseTimeFunction.TRAILING_12_MONTHS.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(-12,TimePeriodType.MONTH);
  }
 else   if (IBuildInBaseTimeFunction.YEAR_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.YEAR);
  }
 else   if (IBuildInBaseTimeFunction.QUARTER_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.QUARTER);
  }
 else   if (IBuildInBaseTimeFunction.MONTH_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.MONTH);
  }
 else   if (IBuildInBaseTimeFunction.CURRENT_YEAR.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.YEAR);
  }
 else   if (IBuildInBaseTimeFunction.WEEK_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.WEEK);
  }
 else   if (IBuildInBaseTimeFunction.MONTH_TO_DATE_LAST_YEAR.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.MONTH);
  }
 else   if (IBuildInBaseTimeFunction.QUARTER_TO_DATE_LAST_YEAR.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.QUARTER);
  }
 else   if (IBuildInBaseTimeFunction.PREVIOUS_MONTH_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.MONTH);
  }
 else   if (IBuildInBaseTimeFunction.PREVIOUS_QUARTER_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.QUARTER);
  }
 else   if (IBuildInBaseTimeFunction.PREVIOUS_YEAR_TO_DATE.equals(calculateType)) {
    baseTimePeriod=new TimePeriod(0,TimePeriodType.YEAR);
  }
 else   if (IBuildInBaseTimeFunction.CURRENT_PERIOD_FROM_N_PERIOD_AGO.equals(calculateType) || IBuildInBaseTimeFunction.PERIOD_TO_DATE_FROM_N_PERIOD_AGO.equals(calculateType)) {
    Iterator iter=periodHandle.calculationArgumentsIterator();
    String period1=null;
    while (iter.hasNext()) {
      CalculationArgumentHandle argument=(CalculationArgumentHandle)iter.next();
      if (IArgumentInfo.PERIOD_1.equals(argument.getName())) {
        period1=argument.getValue().getStringExpression();
        break;
      }
    }
    baseTimePeriod=new TimePeriod(0,getTimePeriodType(period1));
  }
 else   if (IBuildInBaseTimeFunction.TRAILING_N_PERIOD_FROM_N_PERIOD_AGO.equals(calculateType)) {
    Iterator iter=periodHandle.calculationArgumentsIterator();
    String period1=null, n=null;
    while (iter.hasNext()) {
      CalculationArgumentHandle argument=(CalculationArgumentHandle)iter.next();
      if (IArgumentInfo.PERIOD_1.equals(argument.getName())) {
        period1=argument.getValue().getStringExpression();
      }
      if (IArgumentInfo.N_PERIOD1.equals(argument.getName())) {
        n=argument.getValue().getStringExpression();
      }
    }
    baseTimePeriod=new TimePeriod(0 - Integer.valueOf(n),getTimePeriodType(period1));
  }
 else   if (IBuildInBaseTimeFunction.NEXT_N_PERIODS.equals(calculateType)) {
    Iterator iter=periodHandle.calculationArgumentsIterator();
    String n=null, period1=null;
    while (iter.hasNext()) {
      CalculationArgumentHandle argument=(CalculationArgumentHandle)iter.next();
      if (IArgumentInfo.PERIOD_1.equals(argument.getName())) {
        period1=argument.getValue().getStringExpression();
      }
      if (IArgumentInfo.N_PERIOD1.equals(argument.getName())) {
        n=argument.getValue().getStringExpression();
      }
    }
    baseTimePeriod=new TimePeriod(Integer.valueOf(n),getTimePeriodType(period1));
  }
  return baseTimePeriod;
}