Program: 62846
Project: 62846
Buggy source:
public String getFeedbackSessionResultsSummaryInSectionAsCsv(String feedbackSessionName,String courseId,String userEmail,String section) throws UnauthorizedAccessException, EntityDoesNotExistException, ExceedingRangeException {
  long indicatedRange=(section == null) ? 10000 : -1;
  FeedbackSessionResultsBundle results=getFeedbackSessionResultsForInstructorInSectionWithinRangeFromView(feedbackSessionName,courseId,userEmail,section,indicatedRange,"String_Node_Str");
  if (!results.isComplete) {
    throw new ExceedingRangeException("String_Node_Str");
  }
  Collections.sort(results.responses,results.compareByGiverRecipientQuestion);
  StringBuilder exportBuilder=new StringBuilder();
  exportBuilder.append("String_Node_Str" + "String_Node_Str" + Sanitizer.sanitizeForCsv(results.feedbackSession.courseId) + Const.EOL+ "String_Node_Str"+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(results.feedbackSession.feedbackSessionName)+ Const.EOL);
  if (section != null) {
    exportBuilder.append("String_Node_Str" + "String_Node_Str" + Sanitizer.sanitizeForCsv(section) + Const.EOL);
  }
  exportBuilder.append(Const.EOL + Const.EOL);
  for (  Map.Entry<FeedbackQuestionAttributes,List<FeedbackResponseAttributes>> entry : results.getQuestionResponseMap().entrySet()) {
    FeedbackQuestionAttributes question=entry.getKey();
    FeedbackQuestionDetails questionDetails=question.getQuestionDetails();
    exportBuilder.append("String_Node_Str" + Integer.toString(entry.getKey().questionNumber) + "String_Node_Str"+ Sanitizer.sanitizeForCsv(questionDetails.questionText)+ Const.EOL+ Const.EOL);
    String statistics=questionDetails.getQuestionResultStatisticsCsv(entry.getValue(),question,results);
    if (statistics != "String_Node_Str") {
      exportBuilder.append("String_Node_Str" + Const.EOL);
      exportBuilder.append(statistics + Const.EOL);
    }
    exportBuilder.append("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + questionDetails.getCsvHeader() + Const.EOL);
    List<String> allPossibleGivers=results.getPossibleGivers(entry.getKey());
    List<String> possibleRecipientsForGiver=null;
    String prevGiver="String_Node_Str";
    for (    FeedbackResponseAttributes response : entry.getValue()) {
      String giverLastName=results.getLastNameForEmail(response.giverEmail);
      String giverFullName=results.getNameForEmail(response.giverEmail);
      String recipientLastName=results.getLastNameForEmail(response.recipientEmail);
      String recipientFulltName=results.getNameForEmail(response.recipientEmail);
      allPossibleGivers.remove(response.giverEmail);
      if (!prevGiver.equals(response.giverEmail)) {
        if (possibleRecipientsForGiver != null) {
          for (          String possibleRecipient : possibleRecipientsForGiver) {
            String prevGiverLastName=results.roster.getStudentForEmail(prevGiver).lastName;
            String possibleRecipientLastName=results.roster.getStudentForEmail(possibleRecipient).lastName;
            exportBuilder.append(Sanitizer.sanitizeForCsv(results.getTeamNameFromRoster(prevGiver)) + "String_Node_Str" + Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(results.getNameFromRoster(prevGiver)))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(prevGiverLastName))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(results.getTeamNameFromRoster(possibleRecipient))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(results.getNameFromRoster(possibleRecipient)))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(possibleRecipientLastName))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(questionDetails.getNoResponseText(prevGiver,possibleRecipient,results,question))+ Const.EOL);
          }
        }
        possibleRecipientsForGiver=results.getPossibleRecipients(entry.getKey(),prevGiver);
      }
      exportBuilder.append(Sanitizer.sanitizeForCsv(results.getTeamNameForEmail(response.giverEmail)) + "String_Node_Str" + Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(giverFullName))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(giverLastName))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(results.getTeamNameForEmail(response.recipientEmail))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(recipientFulltName))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(recipientLastName))+ "String_Node_Str"+ results.getResponseAnswerCsv(response,question)+ Const.EOL);
      prevGiver=response.giverEmail;
    }
    if (possibleRecipientsForGiver != null) {
      for (      String possibleRecipient : possibleRecipientsForGiver) {
        String prevGiverLastName=results.roster.getStudentForEmail(prevGiver).lastName;
        String possibleRecipientLastName=results.roster.getStudentForEmail(possibleRecipient).lastName;
        exportBuilder.append(Sanitizer.sanitizeForCsv(results.getTeamNameFromRoster(prevGiver)) + "String_Node_Str" + Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(results.getNameFromRoster(prevGiver)))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(prevGiverLastName))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(results.getTeamNameFromRoster(possibleRecipient))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(results.getNameFromRoster(possibleRecipient)))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(possibleRecipientLastName))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(questionDetails.getNoResponseText(prevGiver,possibleRecipient,results,question))+ Const.EOL);
      }
      allPossibleGivers.remove(prevGiver);
    }
    for (    String possibleGiver : allPossibleGivers) {
      possibleRecipientsForGiver=results.getPossibleRecipients(entry.getKey(),possibleGiver);
      for (      String possibleRecipient : possibleRecipientsForGiver) {
        String possibleGiverLastName=results.getLastNameFromRoster(possibleGiver);
        String possibleRecipientLastName=results.getLastNameFromRoster(possibleRecipient);
        exportBuilder.append(Sanitizer.sanitizeForCsv(results.getTeamNameFromRoster(possibleGiver)) + "String_Node_Str" + Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(results.getNameFromRoster(possibleGiver)))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(possibleGiverLastName))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(results.getTeamNameFromRoster(possibleRecipient))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(results.getNameFromRoster(possibleRecipient)))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(possibleRecipientLastName))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(questionDetails.getNoResponseText(possibleGiver,possibleRecipient,results,question))+ Const.EOL);
      }
    }
    exportBuilder.append(Const.EOL + Const.EOL);
  }
  return exportBuilder.toString();
}

Fixed version (ground truth):
public String getFeedbackSessionResultsSummaryInSectionAsCsv(String feedbackSessionName,String courseId,String userEmail,String section) throws UnauthorizedAccessException, EntityDoesNotExistException, ExceedingRangeException {
  long indicatedRange=(section == null) ? 10000 : -1;
  FeedbackSessionResultsBundle results=getFeedbackSessionResultsForInstructorInSectionWithinRangeFromView(feedbackSessionName,courseId,userEmail,section,indicatedRange,"String_Node_Str");
  if (!results.isComplete) {
    throw new ExceedingRangeException("String_Node_Str");
  }
  Collections.sort(results.responses,results.compareByGiverRecipientQuestion);
  StringBuilder exportBuilder=new StringBuilder();
  exportBuilder.append("String_Node_Str" + "String_Node_Str" + Sanitizer.sanitizeForCsv(results.feedbackSession.courseId) + Const.EOL+ "String_Node_Str"+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(results.feedbackSession.feedbackSessionName)+ Const.EOL);
  if (section != null) {
    exportBuilder.append("String_Node_Str" + "String_Node_Str" + Sanitizer.sanitizeForCsv(section) + Const.EOL);
  }
  exportBuilder.append(Const.EOL + Const.EOL);
  for (  Map.Entry<FeedbackQuestionAttributes,List<FeedbackResponseAttributes>> entry : results.getQuestionResponseMap().entrySet()) {
    FeedbackQuestionAttributes question=entry.getKey();
    FeedbackQuestionDetails questionDetails=question.getQuestionDetails();
    exportBuilder.append("String_Node_Str" + Integer.toString(entry.getKey().questionNumber) + "String_Node_Str"+ Sanitizer.sanitizeForCsv(questionDetails.questionText)+ Const.EOL+ Const.EOL);
    String statistics=questionDetails.getQuestionResultStatisticsCsv(entry.getValue(),question,results);
    if (statistics != "String_Node_Str") {
      exportBuilder.append("String_Node_Str" + Const.EOL);
      exportBuilder.append(statistics + Const.EOL);
    }
    exportBuilder.append("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + questionDetails.getCsvHeader() + Const.EOL);
    List<String> allPossibleGivers=results.getPossibleGivers(entry.getKey());
    List<String> possibleRecipientsForGiver=null;
    String prevGiver=null;
    for (    FeedbackResponseAttributes response : entry.getValue()) {
      String giverLastName=results.getLastNameForEmail(response.giverEmail);
      String giverFullName=results.getNameForEmail(response.giverEmail);
      String recipientLastName=results.getLastNameForEmail(response.recipientEmail);
      String recipientFullName=results.getNameForEmail(response.recipientEmail);
      if (question.giverType == FeedbackParticipantType.TEAMS) {
        allPossibleGivers.remove(results.getNameFromRoster(response.giverEmail));
      }
 else {
        allPossibleGivers.remove(response.giverEmail);
      }
      boolean isNewGiver=(prevGiver == null) || !prevGiver.equals(response.giverEmail);
      if (isNewGiver) {
        if (possibleRecipientsForGiver != null) {
          exportBuilder.append(getRowsOfPossibleRecipientsInCsvFormat(results,question,questionDetails,possibleRecipientsForGiver,prevGiver));
        }
        String giverEmail=(question.giverType == FeedbackParticipantType.TEAMS) ? results.getNameFromRoster(response.giverEmail) : response.giverEmail;
        possibleRecipientsForGiver=results.getPossibleRecipients(entry.getKey(),giverEmail);
        exportBuilder.append(Const.EOL);
      }
      exportBuilder.append(Sanitizer.sanitizeForCsv(results.getTeamNameForEmail(response.giverEmail)) + "String_Node_Str" + Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(giverFullName))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(giverLastName))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(results.getTeamNameForEmail(response.recipientEmail))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(recipientFullName))+ "String_Node_Str"+ Sanitizer.sanitizeForCsv(StringHelper.removeExtraSpace(recipientLastName))+ "String_Node_Str"+ results.getResponseAnswerCsv(response,question)+ Const.EOL);
      if (question.recipientType == FeedbackParticipantType.TEAMS) {
        possibleRecipientsForGiver.remove(results.getNameFromRoster(response.recipientEmail));
      }
 else {
        possibleRecipientsForGiver.remove(response.recipientEmail);
      }
      prevGiver=response.giverEmail;
    }
    if (possibleRecipientsForGiver != null) {
      exportBuilder.append(getRowsOfPossibleRecipientsInCsvFormat(results,question,questionDetails,possibleRecipientsForGiver,prevGiver));
      allPossibleGivers.remove(prevGiver);
      if (question.giverType == FeedbackParticipantType.TEAMS) {
        allPossibleGivers.remove(results.getNameFromRoster(prevGiver));
      }
 else {
        allPossibleGivers.remove(prevGiver);
      }
    }
    for (    String possibleGiverWithNoResponses : allPossibleGivers) {
      possibleRecipientsForGiver=results.getPossibleRecipients(entry.getKey(),possibleGiverWithNoResponses);
      exportBuilder.append(getRowsOfPossibleRecipientsInCsvFormat(results,question,questionDetails,possibleRecipientsForGiver,possibleGiverWithNoResponses));
    }
    exportBuilder.append(Const.EOL + Const.EOL);
  }
  return exportBuilder.toString();
}