Program: 62849
Project: 62849
Buggy source:
private int filterFeedbackResponseCommentResults(FeedbackResponseCommentSearchResultBundle frCommentSearchResults,List<InstructorAttributes> instructors,int totalResultsSize){
  Iterator<Entry<String,List<FeedbackResponseAttributes>>> iterFr=frCommentSearchResults.responses.entrySet().iterator();
  while (iterFr.hasNext()) {
    List<FeedbackResponseAttributes> frs=iterFr.next().getValue();
    Iterator<FeedbackResponseAttributes> fr=frs.iterator();
    while (fr.hasNext()) {
      FeedbackResponseAttributes response=fr.next();
      FeedbackQuestionAttributes relatedQuestion=getRelatedQuestionOfResponse(frCommentSearchResults,response);
      InstructorAttributes instructor=this.getInstructorForCourseId(response.courseId,instructors);
      boolean isVisibleResponse=true;
      boolean needCheckPrivilege=relatedQuestion == null || !(relatedQuestion.recipientType == FeedbackParticipantType.NONE || relatedQuestion.recipientType == FeedbackParticipantType.INSTRUCTORS || relatedQuestion.recipientType == FeedbackParticipantType.STUDENTS);
      boolean isNotAllowedForInstructor=instructor == null || !(instructor.isAllowedForPrivilege(response.giverSection,response.feedbackSessionName,Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)) || !(instructor.isAllowedForPrivilege(response.recipientSection,response.feedbackSessionName,Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS));
      if (needCheckPrivilege && isNotAllowedForInstructor) {
        isVisibleResponse=false;
      }
      if (isVisibleResponse) {
        int sizeOfCommentList=frCommentSearchResults.comments.get(response.getId()).size();
        totalResultsSize-=sizeOfCommentList;
        frCommentSearchResults.comments.remove(response.getId());
        fr.remove();
      }
    }
  }
  return totalResultsSize;
}

Fixed version (ground truth):
private int filterFeedbackResponseCommentResults(FeedbackResponseCommentSearchResultBundle frCommentSearchResults,List<InstructorAttributes> instructors,int totalResultsSize){
  Iterator<Entry<String,List<FeedbackResponseAttributes>>> iterFr=frCommentSearchResults.responses.entrySet().iterator();
  while (iterFr.hasNext()) {
    List<FeedbackResponseAttributes> frs=iterFr.next().getValue();
    Iterator<FeedbackResponseAttributes> fr=frs.iterator();
    while (fr.hasNext()) {
      FeedbackResponseAttributes response=fr.next();
      FeedbackQuestionAttributes relatedQuestion=getRelatedQuestionOfResponse(frCommentSearchResults,response);
      InstructorAttributes instructor=this.getInstructorForCourseId(response.courseId,instructors);
      boolean isVisibleResponse=true;
      boolean needCheckPrivilege=relatedQuestion == null || !(relatedQuestion.recipientType == FeedbackParticipantType.NONE || relatedQuestion.recipientType == FeedbackParticipantType.INSTRUCTORS || relatedQuestion.recipientType == FeedbackParticipantType.STUDENTS);
      boolean isNotAllowedForInstructor=instructor == null || !(instructor.isAllowedForPrivilege(response.giverSection,response.feedbackSessionName,Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)) || !(instructor.isAllowedForPrivilege(response.recipientSection,response.feedbackSessionName,Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS));
      if (needCheckPrivilege && isNotAllowedForInstructor) {
        isVisibleResponse=false;
      }
      if (!isVisibleResponse) {
        int sizeOfCommentList=frCommentSearchResults.comments.get(response.getId()).size();
        totalResultsSize-=sizeOfCommentList;
        frCommentSearchResults.comments.remove(response.getId());
        fr.remove();
      }
    }
  }
  return totalResultsSize;
}