Program: 62797
Project: 62797
Buggy source:
private LinkedHashMap<String,Map<FeedbackQuestionAttributes,List<FeedbackResponseAttributes>>> buildResponsesPanelsForGiverQuestionRecipient(FeedbackSessionResultsBundle bundle,ViewType viewType,FieldValidator validator,Map<String,Map<FeedbackQuestionAttributes,List<FeedbackResponseAttributes>>> sortedResponses){
  LinkedHashMap<String,Map<FeedbackQuestionAttributes,List<FeedbackResponseAttributes>>> responsesGroupedByTeam=bundle.getQuestionResponseMapByGiverTeam();
  sectionPanels=new LinkedHashMap<String,InstructorFeedbackResultsSectionPanel>();
  InstructorFeedbackResultsSectionPanel sectionPanel=new InstructorFeedbackResultsSectionPanel();
  Set<String> sectionsInCourse=bundle.rosterSectionTeamNameTable.keySet();
  Set<String> sectionsWithResponses=new HashSet<String>();
  String prevSection=Const.DEFAULT_SECTION;
  Set<String> teamsInSection=new HashSet<String>();
  Set<String> teamsWithResponses=new HashSet<String>();
  String prevTeam="String_Node_Str";
  Set<String> teamMembersInTeam=new HashSet<String>();
  Set<String> teamMembersWithResponses=new HashSet<String>();
  int giverIndex=this.startIndex;
  for (  Map.Entry<String,Map<FeedbackQuestionAttributes,List<FeedbackResponseAttributes>>> responsesFromGiver : sortedResponses.entrySet()) {
    giverIndex+=1;
    String giverIdentifier=responsesFromGiver.getKey();
    String currentTeam=getCurrentTeam(bundle,giverIdentifier);
    String currentSection=getCurrentSection(responsesFromGiver);
    if (!prevTeam.equals(currentTeam)) {
      boolean isFirstTeam=prevTeam.equals("String_Node_Str");
      if (!isFirstTeam) {
        createMissingParticipantPanelsForPrevTeamAndResetVariables(bundle,validator,sectionPanel,prevTeam,teamsWithResponses,teamMembersWithResponses,teamMembersInTeam,currentTeam);
        teamsWithResponses.add(currentTeam);
      }
      prevTeam=currentTeam;
    }
    if (!prevSection.equals(currentSection)) {
      boolean isFirstSection=sectionPanel.getParticipantPanels().isEmpty();
      if (!isFirstSection) {
        createTeamAndParticipantPanelsForPrevSectionAndResetVariables(bundle,validator,sectionPanel,prevSection,sectionsWithResponses,teamsWithResponses,teamsInSection,currentTeam);
        sectionPanel=new InstructorFeedbackResultsSectionPanel();
      }
      teamsInSection=bundle.getTeamsInSectionFromRoster(currentSection);
    }
    FeedbackQuestionAttributes questionForGiver=null;
    List<InstructorResultsQuestionTable> questionTables=new ArrayList<InstructorResultsQuestionTable>();
    int questionIndex=0;
    for (    Map.Entry<FeedbackQuestionAttributes,List<FeedbackResponseAttributes>> responsesFromGiverForQuestion : responsesFromGiver.getValue().entrySet()) {
      if (responsesFromGiverForQuestion.getValue().isEmpty()) {
        continue;
      }
      questionIndex+=1;
      FeedbackQuestionAttributes currentQuestion=responsesFromGiverForQuestion.getKey();
      List<FeedbackResponseAttributes> responsesForQuestion=responsesFromGiverForQuestion.getValue();
      sectionPanel.getIsTeamWithResponses().put(currentTeam,true);
      InstructorResultsQuestionTable questionTable=buildQuestionTable(currentQuestion,responsesForQuestion,viewType,"String_Node_Str" + giverIndex + "String_Node_Str"+ questionIndex,false);
      questionTable.setBoldQuestionNumber(false);
      questionTables.add(questionTable);
      questionForGiver=currentQuestion;
    }
    InstructorResultsModerationButton moderationButton=buildModerationButtonForGiver(null,giverIdentifier,"String_Node_Str","String_Node_Str");
    InstructorFeedbackResultsGroupByQuestionPanel giverPanel=buildInstructorFeedbackResultsGroupByQuestionPanel(validator,giverIdentifier,bundle.getNameForEmail(giverIdentifier),questionForGiver,questionTables,moderationButton,bundle.isParticipantIdentifierStudent(giverIdentifier),true);
    giverPanel.setModerationButtonDisplayed(bundle.isParticipantIdentifierStudent(giverIdentifier));
    addParticipantPanelToSectionPanel(sectionPanel,currentTeam,giverPanel);
    teamMembersWithResponses.add(giverIdentifier);
    prevSection=currentSection;
  }
  createTeamAndParticipantPanelsForLastParticipantSection(bundle,validator,sectionPanel,prevSection,prevTeam,sectionsWithResponses,teamsWithResponses,teamsInSection,teamMembersWithResponses);
  createSectionPanelsForMissingSections(bundle,validator,sectionsInCourse,sectionsWithResponses);
  return responsesGroupedByTeam;
}

Fixed version (ground truth):
private LinkedHashMap<String,Map<FeedbackQuestionAttributes,List<FeedbackResponseAttributes>>> buildResponsesPanelsForGiverQuestionRecipient(FeedbackSessionResultsBundle bundle,ViewType viewType,Map<String,Map<FeedbackQuestionAttributes,List<FeedbackResponseAttributes>>> sortedResponses){
  FieldValidator validator=new FieldValidator();
  LinkedHashMap<String,Map<FeedbackQuestionAttributes,List<FeedbackResponseAttributes>>> responsesGroupedByTeam=bundle.getQuestionResponseMapByGiverTeam();
  Map<String,FeedbackQuestionAttributes> questions=bundle.questions;
  sectionPanels=new LinkedHashMap<String,InstructorFeedbackResultsSectionPanel>();
  InstructorFeedbackResultsSectionPanel sectionPanel=new InstructorFeedbackResultsSectionPanel();
  Set<String> sectionsInCourse=bundle.rosterSectionTeamNameTable.keySet();
  Set<String> sectionsWithResponses=new HashSet<String>();
  String prevSection=Const.DEFAULT_SECTION;
  Set<String> teamsInSection=new HashSet<String>();
  Set<String> teamsWithResponses=new HashSet<String>();
  String prevTeam="String_Node_Str";
  Set<String> teamMembersInTeam=new HashSet<String>();
  Set<String> teamMembersWithResponses=new HashSet<String>();
  int giverIndex=this.startIndex;
  for (  Map.Entry<String,Map<FeedbackQuestionAttributes,List<FeedbackResponseAttributes>>> responsesFromGiver : sortedResponses.entrySet()) {
    giverIndex+=1;
    String giverIdentifier=responsesFromGiver.getKey();
    String currentTeam=getCurrentTeam(bundle,giverIdentifier);
    String currentSection=getCurrentSection(responsesFromGiver);
    if (!prevTeam.equals(currentTeam)) {
      boolean isFirstTeam=prevTeam.equals("String_Node_Str");
      if (!isFirstTeam) {
        createMissingParticipantPanelsForPrevTeamAndResetVariables(bundle,validator,sectionPanel,prevTeam,teamsWithResponses,teamMembersWithResponses,teamMembersInTeam,currentTeam);
      }
      prevTeam=currentTeam;
      teamsWithResponses.add(currentTeam);
    }
    if (!prevSection.equals(currentSection)) {
      boolean isFirstSection=sectionPanel.getParticipantPanels().isEmpty();
      if (!isFirstSection) {
        buildTeamStatisticsTableForSectionPanel(sectionPanel,prevSection,viewType,questions,responsesGroupedByTeam,teamsWithResponses);
        createMissingTeamAndParticipantPanelsForPrevSectionAndResetVariables(bundle,validator,sectionPanel,prevSection,sectionsWithResponses,teamsWithResponses,teamsInSection,currentTeam);
        sectionPanel=new InstructorFeedbackResultsSectionPanel();
      }
      teamsInSection=bundle.getTeamsInSectionFromRoster(currentSection);
    }
    FeedbackQuestionAttributes questionForGiver=null;
    List<InstructorResultsQuestionTable> questionTables=new ArrayList<InstructorResultsQuestionTable>();
    int questionIndex=0;
    for (    Map.Entry<FeedbackQuestionAttributes,List<FeedbackResponseAttributes>> responsesFromGiverForQuestion : responsesFromGiver.getValue().entrySet()) {
      if (responsesFromGiverForQuestion.getValue().isEmpty()) {
        continue;
      }
      questionIndex+=1;
      FeedbackQuestionAttributes currentQuestion=responsesFromGiverForQuestion.getKey();
      List<FeedbackResponseAttributes> responsesForQuestion=responsesFromGiverForQuestion.getValue();
      sectionPanel.getIsTeamWithResponses().put(currentTeam,true);
      InstructorResultsQuestionTable questionTable=buildQuestionTable(currentQuestion,responsesForQuestion,viewType,"String_Node_Str" + giverIndex + "String_Node_Str"+ questionIndex,false);
      questionTable.setBoldQuestionNumber(false);
      questionTables.add(questionTable);
      questionForGiver=currentQuestion;
    }
    InstructorResultsModerationButton moderationButton=buildModerationButtonForGiver(null,giverIdentifier,"String_Node_Str","String_Node_Str");
    InstructorFeedbackResultsGroupByQuestionPanel giverPanel=buildInstructorFeedbackResultsGroupByQuestionPanel(validator,giverIdentifier,bundle.getNameForEmail(giverIdentifier),questionForGiver,questionTables,moderationButton,bundle.isParticipantIdentifierStudent(giverIdentifier),true);
    giverPanel.setModerationButtonDisplayed(bundle.isParticipantIdentifierStudent(giverIdentifier));
    addParticipantPanelToSectionPanel(sectionPanel,currentTeam,giverPanel);
    teamMembersWithResponses.add(giverIdentifier);
    prevSection=currentSection;
  }
  buildTeamStatisticsTableForSectionPanel(sectionPanel,prevSection,viewType,questions,responsesGroupedByTeam,teamsWithResponses);
  createTeamAndParticipantPanelsForLastParticipantSection(bundle,validator,sectionPanel,prevSection,prevTeam,sectionsWithResponses,teamsWithResponses,teamsInSection,teamMembersWithResponses);
  createSectionPanelsForMissingSections(bundle,validator,sectionsInCourse,sectionsWithResponses);
  return responsesGroupedByTeam;
}