Program: 152740
Project: 152740
Buggy source:
private GUIDay analyseDay(DateTime date,List<Lesson> lessons){
  GUIDay day=new GUIDay();
  day.setDate(date);
  boolean dispZerolesson=settings.isDisplayZerothLesson();
  timegridForDateTimeDay=new ArrayList<TimegridUnit>();
  List<TimegridUnit> timegridForDay=timegrid.getTimegridForDateTimeDay(date.getWeekDay());
  webuntisOnlyZeroTimegridUnitsHack(timegridForDay);
  for (  TimegridUnit timegridUnit : timegridForDay) {
    if (!dispZerolesson) {
      if (timegridUnit.getName().equals("String_Node_Str") && timegridUnit.getEnd().getHour() <= 8 && timegridUnit.getEnd().getMinute() == 0) {
        zerolesson=timegridUnit;
      }
 else {
        timegridForDateTimeDay.add(timegridUnit);
      }
    }
 else {
      timegridForDateTimeDay.add(timegridUnit);
    }
  }
  if (zerolesson != null)   Log.d("String_Node_Str","String_Node_Str" + zerolesson.getStart() + "String_Node_Str"+ zerolesson.getEnd()+ "String_Node_Str"+ date.toString());
  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 (!dispZerolesson && zerolesson != null && lessonsSameStartTime(lesson,zerolesson) && lessonSameEndTime(lesson,zerolesson)) {
        lessons.remove(j);
      }
 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(j);
        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());
        if (i != timegridForDateTimeDay.size() - 1) {
          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);
        }
        lessons.add(tmp1);
      }
 else       if ((lesson.getStartTime().getHour() < timegridForDateTimeDay.get(0).getStart().getHour())) {
        lessons.remove(j);
        Lesson tmp1=new Lesson();
        tmp1.setDate(lesson.getDate().getYear(),lesson.getDate().getMonth(),lesson.getDate().getDay());
        tmp1.setStartTime(timegridForDateTimeDay.get(0).getStart().getHour(),timegridForDateTimeDay.get(0).getStart().getMinute());
        tmp1.setEndTime(lesson.getEndTime().getHour(),lesson.getEndTime().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());
        lessons.add(tmp1);
      }
 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()) {
        if (lesson.getLessonCode() instanceof LessonCodeIrregular || lesson.getLessonCode() instanceof LessonCodeCancelled || lesson.getLessonCode() instanceof LessonCodeSubstitute) {
          lessoncon.addSpecialLesson(lesson);
        }
 else {
          lessoncon.addStandardLesson(lesson);
        }
      }
    }
    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);
  boolean dispZerolesson=settings.isDisplayZerothLesson();
  timegridForDateTimeDay=new ArrayList<TimegridUnit>();
  List<TimegridUnit> timegridForDay=timegrid.getTimegridForDateTimeDay(date.getWeekDay());
  if (lessons.size() == 0 || timegridForDay == null) {
    for (    TimegridUnit timegridUnit : timegridForDateTimeDay) {
      GUILessonContainer lessoncon=new GUILessonContainer();
      lessoncon.setTime(timegridUnit.getStart(),timegridUnit.getEnd());
      lessoncon.setDate(date);
      day.addLessonContainer(timegridUnit.getStart(),lessoncon);
    }
    return day;
  }
  webuntisOnlyZeroTimegridUnitsHack(timegridForDay);
  for (  TimegridUnit timegridUnit : timegridForDay) {
    if (!dispZerolesson) {
      if (timegridUnit.getName().equals("String_Node_Str") && timegridUnit.getEnd().getHour() <= 8 && timegridUnit.getEnd().getMinute() == 0) {
        zerolesson=timegridUnit;
      }
 else {
        timegridForDateTimeDay.add(timegridUnit);
      }
    }
 else {
      timegridForDateTimeDay.add(timegridUnit);
    }
  }
  if (zerolesson != null)   Log.d("String_Node_Str","String_Node_Str" + zerolesson.getStart() + "String_Node_Str"+ zerolesson.getEnd()+ "String_Node_Str"+ date.toString());
  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 (!dispZerolesson && zerolesson != null && lessonsSameStartTime(lesson,zerolesson) && lessonSameEndTime(lesson,zerolesson)) {
        lessons.remove(j);
      }
 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(j);
        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());
        if (i != timegridForDateTimeDay.size() - 1) {
          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);
        }
        lessons.add(tmp1);
      }
 else       if ((lesson.getStartTime().getHour() < timegridForDateTimeDay.get(0).getStart().getHour())) {
        lessons.remove(j);
        Lesson tmp1=new Lesson();
        tmp1.setDate(lesson.getDate().getYear(),lesson.getDate().getMonth(),lesson.getDate().getDay());
        tmp1.setStartTime(timegridForDateTimeDay.get(0).getStart().getHour(),timegridForDateTimeDay.get(0).getStart().getMinute());
        tmp1.setEndTime(lesson.getEndTime().getHour(),lesson.getEndTime().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());
        lessons.add(tmp1);
      }
 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()) {
        if (lesson.getLessonCode() instanceof LessonCodeIrregular || lesson.getLessonCode() instanceof LessonCodeCancelled || lesson.getLessonCode() instanceof LessonCodeSubstitute) {
          lessoncon.addSpecialLesson(lesson);
        }
 else {
          lessoncon.addStandardLesson(lesson);
        }
      }
    }
    day.addLessonContainer(timegridUnit.getStart(),lessoncon);
  }
  return day;
}