Program: 66039
Project: 66039
Buggy source:
protected void retrieveWeek(List<TimeMember> list,Calendar cal,String[] levels,String type){
  int endWeek=cal.get(Calendar.WEEK_OF_YEAR);
  int startWeek=1;
  int startMonth=1;
  Calendar startCal=(Calendar)cal.clone();
  if (type.equals("String_Node_Str")) {
    startCal.set(Calendar.MONTH,0);
    startCal.set(Calendar.DAY_OF_MONTH,1);
    if (startCal.get(Calendar.WEEK_OF_YEAR) > 1) {
      int[] newValues=getValueFromCal(startCal,levels);
      TimeMember newMember=new TimeMember(newValues,levels);
      list.add(newMember);
      startCal.add(Calendar.WEEK_OF_YEAR,1);
    }
    startWeek=1;
  }
 else   if (type.equals("String_Node_Str")) {
    int quarter=cal.get(Calendar.MONTH) / 3 + 1;
    startMonth=quarter * 3 - 2;
    startCal.set(Calendar.MONTH,startMonth - 1);
    startCal.set(Calendar.DAY_OF_MONTH,1);
    startWeek=startCal.get(Calendar.WEEK_OF_YEAR);
  }
 else   if (type.equals("String_Node_Str")) {
    startMonth=cal.get(Calendar.MONTH);
    startCal.set(Calendar.MONTH,startMonth);
    startCal.set(Calendar.DAY_OF_MONTH,1);
    startWeek=startCal.get(Calendar.WEEK_OF_YEAR);
  }
  TimeMember newMember=null;
  for (int i=startWeek; i <= endWeek; i++) {
    int[] newValues=getValueFromCal(startCal,levels);
    newMember=new TimeMember(newValues,levels);
    list.add(newMember);
    if (i != startWeek && isAddExtraWeek(type,startCal)) {
      addExtraWeek(list,startCal,newMember,levels);
    }
    startCal.add(Calendar.WEEK_OF_YEAR,1);
    startCal.set(Calendar.DAY_OF_WEEK,1);
  }
}

Fixed version (ground truth):
protected void retrieveWeek(List<TimeMember> list,Calendar cal,String[] levels,String type){
  int endWeek=cal.get(Calendar.WEEK_OF_YEAR);
  int startWeek=1;
  int startMonth=1;
  Calendar startCal=(Calendar)cal.clone();
  if (type.equals("String_Node_Str")) {
    startCal.set(Calendar.MONTH,0);
    startCal.set(Calendar.DAY_OF_MONTH,1);
    if (startCal.get(Calendar.WEEK_OF_YEAR) > 1) {
      int[] newValues=getValueFromCal(startCal,levels);
      TimeMember newMember=new TimeMember(newValues,levels);
      list.add(newMember);
      startCal.add(Calendar.WEEK_OF_YEAR,1);
    }
    startWeek=1;
  }
 else   if (type.equals("String_Node_Str")) {
    int quarter=cal.get(Calendar.MONTH) / 3 + 1;
    startMonth=quarter * 3 - 3;
    startCal.set(Calendar.MONTH,startMonth);
    startCal.set(Calendar.DAY_OF_MONTH,1);
    if (startMonth == 0 && startCal.get(Calendar.WEEK_OF_YEAR) > 1) {
      int[] newValues=getValueFromCal(startCal,levels);
      TimeMember newMember=new TimeMember(newValues,levels);
      list.add(newMember);
      startCal.add(Calendar.WEEK_OF_YEAR,1);
    }
    startWeek=startCal.get(Calendar.WEEK_OF_YEAR);
  }
 else   if (type.equals("String_Node_Str")) {
    startMonth=cal.get(Calendar.MONTH);
    startCal.set(Calendar.MONTH,startMonth);
    startCal.set(Calendar.DAY_OF_MONTH,1);
    if (startMonth == 0 && startCal.get(Calendar.WEEK_OF_YEAR) > 1) {
      int[] newValues=getValueFromCal(startCal,levels);
      TimeMember newMember=new TimeMember(newValues,levels);
      list.add(newMember);
      startCal.add(Calendar.WEEK_OF_YEAR,1);
    }
    startWeek=startCal.get(Calendar.WEEK_OF_YEAR);
  }
  TimeMember newMember=null;
  for (int i=startWeek; i <= endWeek; i++) {
    int[] newValues=getValueFromCal(startCal,levels);
    newMember=new TimeMember(newValues,levels);
    list.add(newMember);
    if (i != startWeek && isAddExtraWeek(type,startCal)) {
      addExtraWeek(list,startCal,newMember,levels);
    }
    startCal.add(Calendar.WEEK_OF_YEAR,1);
    startCal.set(Calendar.DAY_OF_WEEK,1);
  }
}