Program: 62769
Project: 62769
Buggy source:
private void buildSectionPanelsForRecipientGiverQuestion(Map<String,Map<String,List<FeedbackResponseAttributes>>> sortedResponses){
  final String additionalInfoId="String_Node_Str";
  sectionPanels=new LinkedHashMap<String,InstructorFeedbackResultsSectionPanel>();
  InstructorFeedbackResultsSectionPanel sectionPanel=new InstructorFeedbackResultsSectionPanel();
  String prevSection=Const.DEFAULT_SECTION;
  String prevTeam="String_Node_Str";
  Set<String> sectionsWithResponses=new HashSet<String>();
  Set<String> teamsWithResponses=new HashSet<String>();
  Set<String> teamMembersWithResponses=new HashSet<String>();
  int recipientIndex=this.startIndex;
  for (  Map.Entry<String,Map<String,List<FeedbackResponseAttributes>>> recipientToGiverToResponsesMap : sortedResponses.entrySet()) {
    recipientIndex+=1;
    String recipientIdentifier=recipientToGiverToResponsesMap.getKey();
    String currentTeam=getCurrentTeam(bundle,recipientIdentifier);
    String currentSection=getCurrentSection(recipientToGiverToResponsesMap);
    boolean isChangeOfTeam=!prevTeam.equals(currentTeam);
    boolean isChangeOfSection=!prevSection.equals(currentSection);
    if (isChangeOfTeam) {
      boolean isFirstTeam=prevTeam.isEmpty();
      if (!isFirstTeam) {
        buildMissingParticipantPanelsWithoutModerationButtonForTeam(sectionPanel,prevTeam,teamMembersWithResponses);
        teamMembersWithResponses.clear();
      }
      teamsWithResponses.add(currentTeam);
      if (!isChangeOfSection) {
        sectionPanel.getIsTeamWithResponses().put(currentTeam,true);
      }
    }
    if (isChangeOfSection) {
      boolean isFirstSection=sectionPanel.getParticipantPanels().isEmpty();
      if (!isFirstSection) {
        finaliseBuildingSectionPanelWithoutStats(sectionPanel,prevSection);
        buildMissingTeamAndParticipantPanelsWithoutModerationButtonForSection(sectionPanel,prevSection,teamsWithResponses);
        sectionPanels.put(prevSection,sectionPanel);
        sectionsWithResponses.add(prevSection);
        teamsWithResponses.clear();
        teamsWithResponses.add(currentTeam);
        sectionPanel=new InstructorFeedbackResultsSectionPanel();
      }
      sectionPanel.getIsTeamWithResponses().put(currentTeam,true);
    }
    InstructorFeedbackResultsGroupByParticipantPanel recipientPanel=buildGroupByParticipantPanel(recipientIdentifier,currentTeam,additionalInfoId,recipientIndex,recipientToGiverToResponsesMap);
    addParticipantPanelToSectionPanel(sectionPanel,currentTeam,recipientPanel);
    teamMembersWithResponses.add(recipientIdentifier);
    prevTeam=currentTeam;
    prevSection=currentSection;
  }
  buildMissingParticipantPanelsForTeam(sectionPanel,prevTeam,teamMembersWithResponses,viewType.isFirstGroupedByGiver());
  teamsWithResponses.add(prevTeam);
  buildMissingTeamAndParticipantPanelsForSection(sectionPanel,prevSection,teamsWithResponses,viewType.isFirstGroupedByGiver());
  finaliseBuildingSectionPanelWithoutStats(sectionPanel,prevSection);
  sectionPanels.put(prevSection,sectionPanel);
  if (selectedSection.equals("String_Node_Str")) {
    sectionsWithResponses.add(prevSection);
    buildSectionPanelsForMissingSections(sectionsWithResponses);
  }
}

Fixed version (ground truth):
private void buildSectionPanelsForRecipientGiverQuestion(Map<String,Map<String,List<FeedbackResponseAttributes>>> sortedResponses){
  final String additionalInfoId="String_Node_Str";
  sectionPanels=new LinkedHashMap<String,InstructorFeedbackResultsSectionPanel>();
  InstructorFeedbackResultsSectionPanel sectionPanel=new InstructorFeedbackResultsSectionPanel();
  String prevSection=Const.DEFAULT_SECTION;
  String prevTeam="String_Node_Str";
  Set<String> sectionsWithResponses=new HashSet<String>();
  Set<String> teamsWithResponses=new HashSet<String>();
  Set<String> teamMembersWithResponses=new HashSet<String>();
  int recipientIndex=this.startIndex;
  for (  Map.Entry<String,Map<String,List<FeedbackResponseAttributes>>> recipientToGiverToResponsesMap : sortedResponses.entrySet()) {
    recipientIndex+=1;
    String recipientIdentifier=recipientToGiverToResponsesMap.getKey();
    String currentTeam=getCurrentTeam(bundle,recipientIdentifier);
    String currentSection=getCurrentSection(recipientToGiverToResponsesMap);
    boolean isChangeOfTeam=!prevTeam.equals(currentTeam);
    boolean isChangeOfSection=!prevSection.equals(currentSection);
    if (isChangeOfTeam) {
      boolean isFirstTeam=prevTeam.isEmpty();
      if (!isFirstTeam) {
        buildMissingParticipantPanelsForTeam(sectionPanel,prevTeam,teamMembersWithResponses);
        teamMembersWithResponses.clear();
      }
      teamsWithResponses.add(currentTeam);
      if (!isChangeOfSection) {
        sectionPanel.getIsTeamWithResponses().put(currentTeam,true);
      }
    }
    if (isChangeOfSection) {
      boolean isFirstSection=sectionPanel.getParticipantPanels().isEmpty();
      if (!isFirstSection) {
        finaliseBuildingSectionPanelWithoutStats(sectionPanel,prevSection);
        buildMissingTeamAndParticipantPanelsForSection(sectionPanel,prevSection,teamsWithResponses);
        sectionPanels.put(prevSection,sectionPanel);
        sectionsWithResponses.add(prevSection);
        teamsWithResponses.clear();
        teamsWithResponses.add(currentTeam);
        sectionPanel=new InstructorFeedbackResultsSectionPanel();
      }
      sectionPanel.getIsTeamWithResponses().put(currentTeam,true);
    }
    InstructorFeedbackResultsGroupByParticipantPanel recipientPanel=buildGroupByParticipantPanel(recipientIdentifier,currentTeam,additionalInfoId,recipientIndex,recipientToGiverToResponsesMap);
    addParticipantPanelToSectionPanel(sectionPanel,currentTeam,recipientPanel);
    teamMembersWithResponses.add(recipientIdentifier);
    prevTeam=currentTeam;
    prevSection=currentSection;
  }
  buildMissingParticipantPanelsForTeam(sectionPanel,prevTeam,teamMembersWithResponses);
  teamsWithResponses.add(prevTeam);
  buildMissingTeamAndParticipantPanelsForSection(sectionPanel,prevSection,teamsWithResponses);
  finaliseBuildingSectionPanelWithoutStats(sectionPanel,prevSection);
  sectionPanels.put(prevSection,sectionPanel);
  if (isAllSectionsSelected()) {
    sectionsWithResponses.add(prevSection);
    buildSectionPanelsForMissingSections(sectionsWithResponses);
  }
}