Program: 98516
Project: 98516
Buggy source:
public List<CourseListVoVwSmall> getSearchResults(String query,int itemsByPage,int totalHints){
  Date beforeSearch=new Date();
  List<Long> search=facadeFactory.getCoursesFacade().search(query,totalHints);
  if (totalHints <= search.size()) {
    search=search.subList(totalHints - itemsByPage,totalHints);
  }
 else {
    search=search.subList(totalHints - itemsByPage,search.size());
  }
  Date afterSearch=new Date();
  Config.getInstance().getServiceFactory().getLogService().info("String_Node_Str" + query + "String_Node_Str"+ String.valueOf(afterSearch.getTime() - beforeSearch.getTime()));
  ArrayList<CourseListVoVwSmall> results=new ArrayList<CourseListVoVwSmall>();
  HashMap<Long,String> professorsName=new HashMap<Long,String>();
  HashMap<Long,String> subjectsName=new HashMap<Long,String>();
  HashMap<Integer,CourseListVoVwSmall> coursesList=new HashMap<Integer,CourseListVoVwSmall>();
  SubjectVoVwSmall subject;
  for (  Long courseId : search) {
    CourseVoFull course=facadeFactory.getCoursesFacade().getCourse(courseId);
    Long professorId=course.getProfessorVo().getId();
    Long subjectId=course.getSubjectVo().getId();
    if (!professorsName.containsKey(professorId)) {
      professorsName.put(professorId,ProfessorVoVwBuilder.getInstance().getProfessorFull(professorId).getFullName());
    }
    if (!subjectsName.containsKey(subjectId)) {
      SubjectVoFull subjectFull=facadeFactory.getSubjectsFacade().getSubject(subjectId);
      subject=new SubjectVoVwSmall(subjectId,subjectFull.getVo().getName(),subjectFull.getVo().getCode(),subjectFull.getRatingSummary());
      subjectsName.put(subjectId,"String_Node_Str" + subject.getCode() + "String_Node_Str"+ subject.getName());
    }
    CourseListVoVwSmall courseList=new CourseListVoVwSmall(professorId,professorsName.get(professorId),subjectId,subjectsName.get(subjectId));
    if (!coursesList.containsKey(courseList.hashCode())) {
      coursesList.put(courseList.hashCode(),courseList);
      results.add(courseList);
    }
    coursesList.get(courseList.hashCode()).addCourse(getCourseVoVwSmall(courseId));
  }
  return results;
}

Fixed version (ground truth):
public List<CourseListVoVwSmall> getSearchResults(String query,int itemsByPage,int totalHints){
  Date beforeSearch=new Date();
  List<Long> search=getSearchCourses(query,totalHints);
  if (totalHints <= search.size()) {
    search=search.subList(totalHints - itemsByPage,totalHints);
  }
 else {
    search=search.subList(totalHints - itemsByPage,search.size());
  }
  Date afterSearch=new Date();
  Config.getInstance().getServiceFactory().getLogService().info("String_Node_Str" + query + "String_Node_Str"+ String.valueOf(afterSearch.getTime() - beforeSearch.getTime()));
  ArrayList<CourseListVoVwSmall> results=new ArrayList<CourseListVoVwSmall>();
  HashMap<Long,String> professorsName=new HashMap<Long,String>();
  HashMap<Long,String> subjectsName=new HashMap<Long,String>();
  HashMap<Integer,CourseListVoVwSmall> coursesList=new HashMap<Integer,CourseListVoVwSmall>();
  SubjectVoVwSmall subject;
  for (  Long courseId : search) {
    CourseVoFull course=facadeFactory.getCoursesFacade().getCourse(courseId);
    Long professorId=course.getProfessorVo().getId();
    Long subjectId=course.getSubjectVo().getId();
    if (!professorsName.containsKey(professorId)) {
      professorsName.put(professorId,ProfessorVoVwBuilder.getInstance().getProfessorFull(professorId).getFullName());
    }
    if (!subjectsName.containsKey(subjectId)) {
      SubjectVoFull subjectFull=facadeFactory.getSubjectsFacade().getSubject(subjectId);
      subject=new SubjectVoVwSmall(subjectId,subjectFull.getVo().getName(),subjectFull.getVo().getCode(),subjectFull.getRatingSummary());
      subjectsName.put(subjectId,"String_Node_Str" + subject.getCode() + "String_Node_Str"+ subject.getName());
    }
    CourseListVoVwSmall courseList=new CourseListVoVwSmall(professorId,professorsName.get(professorId),subjectId,subjectsName.get(subjectId));
    if (!coursesList.containsKey(courseList.hashCode())) {
      coursesList.put(courseList.hashCode(),courseList);
      results.add(courseList);
    }
    coursesList.get(courseList.hashCode()).addCourse(getCourseVoVwSmall(courseId));
  }
  return results;
}