Program: 62855
Project: 62855
Buggy source:
@Override protected ActionResult execute() throws EntityDoesNotExistException {
  courseId=getRequestParamValue(Const.ParamsNames.COURSE_ID);
  feedbackSessionName=getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
  Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID,courseId);
  Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME,feedbackSessionName);
  verifyAccesibleForSpecificUser();
  String userEmailForCourse=getUserEmailForCourse();
  String userSectionForCourse=getUserSectionForCourse();
  data=new FeedbackSubmissionEditPageData(account,student);
  data.bundle=getDataBundle(userEmailForCourse);
  Assumption.assertNotNull("String_Node_Str" + feedbackSessionName + "String_Node_Str"+ courseId+ "String_Node_Str",data.bundle);
  setStatusToAdmin();
  if (!isSessionOpenForSpecificUser(data.bundle.feedbackSession)) {
    isError=true;
    statusToUser.add(Const.StatusMessages.FEEDBACK_SUBMISSIONS_NOT_OPEN);
    return createSpecificRedirectResult();
  }
  int numOfQuestionsToGet=data.bundle.questionResponseBundle.size();
  for (int questionIndx=1; questionIndx <= numOfQuestionsToGet; questionIndx++) {
    String totalResponsesForQuestion=getRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "String_Node_Str" + questionIndx);
    if (totalResponsesForQuestion == null) {
      continue;
    }
    List<FeedbackResponseAttributes> responsesForQuestion=new ArrayList<FeedbackResponseAttributes>();
    String questionId=HttpRequestHelper.getValueFromParamMap(requestParameters,Const.ParamsNames.FEEDBACK_QUESTION_ID + "String_Node_Str" + questionIndx);
    FeedbackQuestionAttributes questionAttributes=data.bundle.getQuestionAttributes(questionId);
    if (questionAttributes == null) {
      statusToUser.add("String_Node_Str");
      isError=true;
      log.warning("String_Node_Str" + questionId + "String_Node_Str"+ questionIndx);
      continue;
    }
    FeedbackAbstractQuestionDetails questionDetails=questionAttributes.getQuestionDetails();
    int numOfResponsesToGet=Integer.parseInt(totalResponsesForQuestion);
    String qnId="String_Node_Str";
    Set<String> emailSet=data.bundle.getRecipientEmails(questionAttributes.getId());
    emailSet.add("String_Node_Str");
    ArrayList<String> responsesRecipients=new ArrayList<String>();
    for (int responseIndx=0; responseIndx < numOfResponsesToGet; responseIndx++) {
      FeedbackResponseAttributes response=extractFeedbackResponseData(requestParameters,questionIndx,responseIndx,questionDetails);
      responsesRecipients.add(response.recipientEmail);
      if (response.responseMetaData.getValue().isEmpty()) {
        saveResponse(response);
      }
 else {
        response.giverEmail=userEmailForCourse;
        response.giverSection=userSectionForCourse;
        responsesForQuestion.add(response);
      }
      qnId=response.feedbackQuestionId;
    }
    List<String> errors=questionDetails.validateResponseAttributes(responsesForQuestion,data.bundle.recipientList.get(qnId).size());
    if (!emailSet.containsAll(responsesRecipients)) {
      errors.add(String.format(Const.StatusMessages.FEEDBACK_RESPONSE_INVALID_RECIPIENT,questionIndx));
    }
    if (errors.isEmpty()) {
      for (      FeedbackResponseAttributes response : responsesForQuestion) {
        saveResponse(response);
      }
    }
 else {
      statusToUser.addAll(errors);
      isError=true;
    }
  }
  if (!isError) {
    statusToUser.add(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
  }
  if (logic.hasGiverRespondedForSession(userEmailForCourse,feedbackSessionName,courseId)) {
    appendRespondant();
  }
 else {
    removeRespondant();
  }
  return createSpecificRedirectResult();
}

Fixed version (ground truth):
@Override protected ActionResult execute() throws EntityDoesNotExistException {
  courseId=getRequestParamValue(Const.ParamsNames.COURSE_ID);
  feedbackSessionName=getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
  Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID,courseId);
  Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME,feedbackSessionName);
  verifyAccesibleForSpecificUser();
  String userEmailForCourse=getUserEmailForCourse();
  String userSectionForCourse=getUserSectionForCourse();
  data=new FeedbackSubmissionEditPageData(account,student);
  data.bundle=getDataBundle(userEmailForCourse);
  Assumption.assertNotNull("String_Node_Str" + feedbackSessionName + "String_Node_Str"+ courseId+ "String_Node_Str",data.bundle);
  setStatusToAdmin();
  if (!isSessionOpenForSpecificUser(data.bundle.feedbackSession)) {
    isError=true;
    statusToUser.add(Const.StatusMessages.FEEDBACK_SUBMISSIONS_NOT_OPEN);
    return createSpecificRedirectResult();
  }
  int numOfQuestionsToGet=data.bundle.questionResponseBundle.size();
  for (int questionIndx=1; questionIndx <= numOfQuestionsToGet; questionIndx++) {
    String totalResponsesForQuestion=getRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "String_Node_Str" + questionIndx);
    if (totalResponsesForQuestion == null) {
      continue;
    }
    List<FeedbackResponseAttributes> responsesForQuestion=new ArrayList<FeedbackResponseAttributes>();
    String questionId=HttpRequestHelper.getValueFromParamMap(requestParameters,Const.ParamsNames.FEEDBACK_QUESTION_ID + "String_Node_Str" + questionIndx);
    FeedbackQuestionAttributes questionAttributes=data.bundle.getQuestionAttributes(questionId);
    if (questionAttributes == null) {
      statusToUser.add("String_Node_Str");
      isError=true;
      log.warning("String_Node_Str" + questionId + "String_Node_Str"+ questionIndx);
      continue;
    }
    FeedbackAbstractQuestionDetails questionDetails=questionAttributes.getQuestionDetails();
    int numOfResponsesToGet=Integer.parseInt(totalResponsesForQuestion);
    String qnId="String_Node_Str";
    Set<String> emailSet=data.bundle.getRecipientEmails(questionAttributes.getId());
    emailSet.add("String_Node_Str");
    emailSet=StringHelper.recoverFromSanitizedText(emailSet);
    ArrayList<String> responsesRecipients=new ArrayList<String>();
    for (int responseIndx=0; responseIndx < numOfResponsesToGet; responseIndx++) {
      FeedbackResponseAttributes response=extractFeedbackResponseData(requestParameters,questionIndx,responseIndx,questionDetails);
      responsesRecipients.add(response.recipientEmail);
      if (response.responseMetaData.getValue().isEmpty()) {
        saveResponse(response);
      }
 else {
        response.giverEmail=userEmailForCourse;
        response.giverSection=userSectionForCourse;
        responsesForQuestion.add(response);
      }
      qnId=response.feedbackQuestionId;
    }
    List<String> errors=questionDetails.validateResponseAttributes(responsesForQuestion,data.bundle.recipientList.get(qnId).size());
    if (!emailSet.containsAll(responsesRecipients)) {
      errors.add(String.format(Const.StatusMessages.FEEDBACK_RESPONSE_INVALID_RECIPIENT,questionIndx));
    }
    if (errors.isEmpty()) {
      for (      FeedbackResponseAttributes response : responsesForQuestion) {
        saveResponse(response);
      }
    }
 else {
      statusToUser.addAll(errors);
      isError=true;
    }
  }
  if (!isError) {
    statusToUser.add(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
  }
  if (logic.hasGiverRespondedForSession(userEmailForCourse,feedbackSessionName,courseId)) {
    appendRespondant();
  }
 else {
    removeRespondant();
  }
  return createSpecificRedirectResult();
}