Program: 152741
Project: 152741
Buggy source:
private GUIDay analyseDay(DateTime date,List<Lesson> lessons){
  GUIDay day=new GUIDay();
  day.setDate(date);
  if (timegridForDateTimeDay == null) {
    timegridForDateTimeDay=timegrid.getTimegridForDay(WebUntis.MONDAY);
  }
  if (lessons.size() == 0) {
    for (    TimegridUnit timegridUnit : timegridForDateTimeDay) {
      GUILessonContainer lessoncon=new GUILessonContainer();
      lessoncon.setTime(timegridUnit.getStart(),timegridUnit.getEnd());
      lessoncon.setDate(date);
      day.addLessonContainer(timegridUnit.getStart(),lessoncon);
    }
    return day;
  }
  for (int i=0; i < timegridForDateTimeDay.size(); i++) {
    TimegridUnit timegridUnit=timegridForDateTimeDay.get(i);
    GUILessonContainer lessoncon=new GUILessonContainer();
    lessoncon.setTime(timegridUnit.getStart(),timegridUnit.getEnd());
    lessoncon.setDate(date);
    for (int j=0; j < lessons.size(); j++) {
      Lesson lesson=lessons.get(j);
      if (lesson.getStartTime().getMinute() == timegridUnit.getStart().getMinute() && lesson.getStartTime().getHour() == timegridUnit.getStart().getHour() && lesson.getEndTime().getMinute() == timegridUnit.getEnd().getMinute() && lesson.getEndTime().getHour() == timegridUnit.getEnd().getHour()) {
        if (lesson.getLessonCode() instanceof LessonCodeIrregular || lesson.getLessonCode() instanceof LessonCodeCancelled || lesson.getLessonCode() instanceof LessonCodeSubstitute) {
          lessoncon.addSpecialLesson(lesson);
        }
 else {
          lessoncon.addStandardLesson(lesson);
        }
      }
 else       if (lesson.getStartTime().getMinute() == timegridUnit.getStart().getMinute() && lesson.getStartTime().getHour() == timegridUnit.getStart().getHour() && (lesson.getEndTime().getMinute() != timegridUnit.getEnd().getMinute() || lesson.getEndTime().getHour() != timegridUnit.getEnd().getHour())) {
        Log.d("String_Node_Str",lesson.toString());
        Lesson tmp1=new Lesson();
        tmp1.setDate(lesson.getDate().getYear(),lesson.getDate().getMonth(),lesson.getDate().getDay());
        tmp1.setStartTime(lesson.getStartTime().getHour(),lesson.getStartTime().getMinute());
        tmp1.setEndTime(timegridUnit.getEnd().getHour(),timegridUnit.getEnd().getMinute());
        tmp1.setId(lesson.getId());
        tmp1.setLessonCode(lesson.getLessonCode());
        tmp1.setLessonType(lesson.getLessonType());
        tmp1.setSchoolClasses(lesson.getSchoolClasses());
        tmp1.setSchoolRooms(lesson.getSchoolRooms());
        tmp1.setSchoolSubjects(lesson.getSchoolSubjects());
        tmp1.setSchoolTeachers(lesson.getSchoolTeachers());
        Lesson tmp2=new Lesson();
        tmp2.setDate(lesson.getDate().getYear(),lesson.getDate().getMonth(),lesson.getDate().getDay());
        tmp2.setStartTime(timegridForDateTimeDay.get(i + 1).getStart().getHour(),timegridForDateTimeDay.get(i + 1).getStart().getMinute());
        tmp2.setEndTime(lesson.getEndTime().getHour(),lesson.getEndTime().getMinute());
        tmp2.setId(lesson.getId());
        tmp2.setLessonCode(lesson.getLessonCode());
        tmp2.setLessonType(lesson.getLessonType());
        tmp2.setSchoolClasses(lesson.getSchoolClasses());
        tmp2.setSchoolRooms(lesson.getSchoolRooms());
        tmp2.setSchoolSubjects(lesson.getSchoolSubjects());
        tmp2.setSchoolTeachers(lesson.getSchoolTeachers());
        lessons.add(tmp2);
        if (tmp1.getLessonCode() instanceof LessonCodeIrregular || tmp1.getLessonCode() instanceof LessonCodeCancelled || tmp1.getLessonCode() instanceof LessonCodeSubstitute) {
          lessoncon.addSpecialLesson(tmp1);
        }
 else {
          lessoncon.addStandardLesson(tmp1);
        }
      }
    }
    day.addLessonContainer(timegridUnit.getStart(),lessoncon);
  }
  return day;
}

Fixed version (ground truth):
private GUIDay analyseDay(DateTime date,List<Lesson> lessons){
  GUIDay day=new GUIDay();
  day.setDate(date);
  if (timegridForDateTimeDay == null) {
    timegridForDateTimeDay=timegrid.getTimegridForDay(WebUntis.MONDAY);
  }
  if (lessons.size() == 0) {
    for (    TimegridUnit timegridUnit : timegridForDateTimeDay) {
      GUILessonContainer lessoncon=new GUILessonContainer();
      lessoncon.setTime(timegridUnit.getStart(),timegridUnit.getEnd());
      lessoncon.setDate(date);
      day.addLessonContainer(timegridUnit.getStart(),lessoncon);
    }
    return day;
  }
  for (int i=0; i < timegridForDateTimeDay.size(); i++) {
    TimegridUnit timegridUnit=timegridForDateTimeDay.get(i);
    GUILessonContainer lessoncon=new GUILessonContainer();
    lessoncon.setTime(timegridUnit.getStart(),timegridUnit.getEnd());
    lessoncon.setDate(date);
    for (int j=0; j < lessons.size(); j++) {
      Lesson lesson=lessons.get(j);
      if (lesson.getStartTime().getMinute() == timegridUnit.getStart().getMinute() && lesson.getStartTime().getHour() == timegridUnit.getStart().getHour() && lesson.getEndTime().getMinute() == timegridUnit.getEnd().getMinute() && lesson.getEndTime().getHour() == timegridUnit.getEnd().getHour()) {
        if (lesson.getLessonCode() instanceof LessonCodeIrregular || lesson.getLessonCode() instanceof LessonCodeCancelled || lesson.getLessonCode() instanceof LessonCodeSubstitute) {
          lessoncon.addSpecialLesson(lesson);
        }
 else {
          lessoncon.addStandardLesson(lesson);
        }
      }
 else       if (lesson.getStartTime().getMinute() == timegridUnit.getStart().getMinute() && lesson.getStartTime().getHour() == timegridUnit.getStart().getHour() && (lesson.getEndTime().getMinute() != timegridUnit.getEnd().getMinute() || lesson.getEndTime().getHour() != timegridUnit.getEnd().getHour())) {
        lessons.remove(i);
        Log.d("String_Node_Str",lesson.toString());
        Lesson tmp1=new Lesson();
        tmp1.setDate(lesson.getDate().getYear(),lesson.getDate().getMonth(),lesson.getDate().getDay());
        tmp1.setStartTime(lesson.getStartTime().getHour(),lesson.getStartTime().getMinute());
        tmp1.setEndTime(timegridUnit.getEnd().getHour(),timegridUnit.getEnd().getMinute());
        tmp1.setId(lesson.getId());
        tmp1.setLessonCode(lesson.getLessonCode());
        tmp1.setLessonType(lesson.getLessonType());
        tmp1.setSchoolClasses(lesson.getSchoolClasses());
        tmp1.setSchoolRooms(lesson.getSchoolRooms());
        tmp1.setSchoolSubjects(lesson.getSchoolSubjects());
        tmp1.setSchoolTeachers(lesson.getSchoolTeachers());
        Lesson tmp2=new Lesson();
        tmp2.setDate(lesson.getDate().getYear(),lesson.getDate().getMonth(),lesson.getDate().getDay());
        tmp2.setStartTime(timegridForDateTimeDay.get(i + 1).getStart().getHour(),timegridForDateTimeDay.get(i + 1).getStart().getMinute());
        tmp2.setEndTime(lesson.getEndTime().getHour(),lesson.getEndTime().getMinute());
        tmp2.setId(lesson.getId());
        tmp2.setLessonCode(lesson.getLessonCode());
        tmp2.setLessonType(lesson.getLessonType());
        tmp2.setSchoolClasses(lesson.getSchoolClasses());
        tmp2.setSchoolRooms(lesson.getSchoolRooms());
        tmp2.setSchoolSubjects(lesson.getSchoolSubjects());
        tmp2.setSchoolTeachers(lesson.getSchoolTeachers());
        lessons.add(tmp2);
        if (tmp1.getLessonCode() instanceof LessonCodeIrregular || tmp1.getLessonCode() instanceof LessonCodeCancelled || tmp1.getLessonCode() instanceof LessonCodeSubstitute) {
          lessoncon.addSpecialLesson(tmp1);
        }
 else {
          lessoncon.addStandardLesson(tmp1);
        }
      }
    }
    day.addLessonContainer(timegridUnit.getStart(),lessoncon);
  }
  return day;
}