Program: 39213
Project: 39213
Buggy source:
private JSONObject getWeeksScale() throws JSONException {
  DateTime dateTimeFrom=new DateTime(dateFrom);
  DateTime dateTimeTo=new DateTime(dateTo);
  int dateTimeFromDayOfWeek=dateTimeFrom.getDayOfWeek();
  int dateTimeToDayOfWeek=dateTimeTo.getDayOfWeek();
  List<Integer> weekNumbers=new ArrayList<Integer>();
  int lastAddedWeekNumber=0;
  while (dateTimeFrom.compareTo(dateTimeTo) < 0) {
    lastAddedWeekNumber=dateTimeFrom.getWeekOfWeekyear();
    weekNumbers.add(lastAddedWeekNumber);
    dateTimeFrom=dateTimeFrom.plusWeeks(1);
  }
  if (dateTimeTo.getWeekOfWeekyear() > lastAddedWeekNumber) {
    lastAddedWeekNumber=dateTimeTo.getWeekOfWeekyear();
    weekNumbers.add(lastAddedWeekNumber);
  }
  JSONArray weeksArray=new JSONArray();
  for (int i=0; i < weekNumbers.size(); i++) {
    if (i == 0 && dateTimeFromDayOfWeek > 5) {
      weeksArray.put("String_Node_Str" + weekNumbers.get(i));
    }
 else     if (i == weekNumbers.size() - 1 && dateTimeToDayOfWeek < 3) {
      weeksArray.put("String_Node_Str" + weekNumbers.get(i));
    }
 else {
      weeksArray.put(ganttChartComponentState.translate("String_Node_Str") + "String_Node_Str" + weekNumbers.get(i));
    }
  }
  JSONObject scaleObject=new JSONObject();
  JSONArray weekDays=new JSONArray();
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  scaleObject.put(JSON_ELEMENTS_IN_CATEGORY,7);
  scaleObject.put("String_Node_Str",weekDays);
  scaleObject.put("String_Node_Str",dateTimeFromDayOfWeek);
  scaleObject.put("String_Node_Str",dateTimeToDayOfWeek);
  scaleObject.put(JSON_CATEGORIES,weeksArray);
  return scaleObject;
}

Fixed version (ground truth):
private JSONObject getWeeksScale() throws JSONException {
  DateTime dateTimeFrom=new DateTime(dateFrom);
  DateTime dateTimeTo=new DateTime(dateTo);
  int dateTimeFromDayOfWeek=dateTimeFrom.getDayOfWeek();
  int dateTimeToDayOfWeek=dateTimeTo.getDayOfWeek();
  List<Integer> weekNumbers=new ArrayList<Integer>();
  int lastAddedWeekNumber=0;
  while (dateTimeFrom.compareTo(dateTimeTo) < 0) {
    lastAddedWeekNumber=dateTimeFrom.getWeekOfWeekyear();
    weekNumbers.add(lastAddedWeekNumber);
    dateTimeFrom=dateTimeFrom.plusWeeks(1);
  }
  if (dateTimeTo.getWeekOfWeekyear() > lastAddedWeekNumber) {
    lastAddedWeekNumber=dateTimeTo.getWeekOfWeekyear();
    weekNumbers.add(lastAddedWeekNumber);
  }
  JSONArray weeksArray=new JSONArray();
  for (int i=0; i < weekNumbers.size(); i++) {
    if (i == 0 && dateTimeFromDayOfWeek > 5) {
      weeksArray.put(weekNumbers.get(i).toString());
    }
 else     if (i == weekNumbers.size() - 1 && dateTimeToDayOfWeek < 3) {
      weeksArray.put(weekNumbers.get(i).toString());
    }
 else {
      weeksArray.put(ganttChartComponentState.translate("String_Node_Str") + "String_Node_Str" + weekNumbers.get(i));
    }
  }
  JSONObject scaleObject=new JSONObject();
  JSONArray weekDays=new JSONArray();
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  weekDays.put(ganttChartComponentState.translate("String_Node_Str"));
  scaleObject.put(JSON_ELEMENTS_IN_CATEGORY,7);
  scaleObject.put("String_Node_Str",weekDays);
  scaleObject.put("String_Node_Str",dateTimeFromDayOfWeek);
  scaleObject.put("String_Node_Str",dateTimeToDayOfWeek);
  scaleObject.put(JSON_CATEGORIES,weeksArray);
  return scaleObject;
}