Program: 62711
Project: 62711
Buggy source:
@Override protected ActionResult execute() throws EntityDoesNotExistException {
  String courseId=getRequestParamValue(Const.ParamsNames.COURSE_ID);
  Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID,courseId);
  String feedbackSessionName=getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
  Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME,feedbackSessionName);
  String feedbackQuestionId=getRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_ID);
  Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_QUESTION_ID,feedbackQuestionId);
  String feedbackResponseId=getRequestParamValue(Const.ParamsNames.FEEDBACK_RESPONSE_ID);
  Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_RESPONSE_ID,feedbackResponseId);
  String commentId=getRequestParamValue(Const.ParamsNames.COMMENT_ID);
  Assumption.assertPostParamNotNull(Const.ParamsNames.COMMENT_ID,commentId);
  InstructorAttributes instructor=logic.getInstructorForGoogleId(courseId,account.googleId);
  FeedbackSessionAttributes session=logic.getFeedbackSession(feedbackSessionName,courseId);
  FeedbackResponseAttributes response=logic.getFeedbackResponse(feedbackResponseId);
  Assumption.assertNotNull(response);
  boolean isCreatorOnly=true;
  gateKeeper.verifyAccessible(instructor,session,!isCreatorOnly,response.giverSection,Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS);
  gateKeeper.verifyAccessible(instructor,session,!isCreatorOnly,response.recipientSection,Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS);
  InstructorFeedbackResponseCommentAjaxPageData data=new InstructorFeedbackResponseCommentAjaxPageData(account,sessionToken);
  String giverEmail=response.giver;
  String recipientEmail=response.recipient;
  FeedbackSessionResultsBundle bundle=logic.getFeedbackSessionResultsForInstructor(feedbackSessionName,courseId,instructor.email);
  String giverName=bundle.getGiverNameForResponse(response);
  String giverTeamName=bundle.getTeamNameForEmail(giverEmail);
  data.giverName=bundle.appendTeamNameToName(giverName,giverTeamName);
  String recipientName=bundle.getRecipientNameForResponse(response);
  String recipientTeamName=bundle.getTeamNameForEmail(recipientEmail);
  data.recipientName=bundle.appendTeamNameToName(recipientName,recipientTeamName);
  String commentText=getRequestParamValue(Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT);
  Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT,commentText);
  if (commentText.trim().isEmpty()) {
    data.errorMessage=Const.StatusMessages.FEEDBACK_RESPONSE_COMMENT_EMPTY;
    data.isError=true;
    return createAjaxResult(data);
  }
  FeedbackResponseCommentAttributes feedbackResponseComment=new FeedbackResponseCommentAttributes(courseId,feedbackSessionName,feedbackQuestionId,instructor.email,feedbackResponseId,new Date(),new Text(commentText),response.giverSection,response.recipientSection);
  String showCommentTo=getRequestParamValue(Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO);
  String showGiverNameTo=getRequestParamValue(Const.ParamsNames.RESPONSE_COMMENTS_SHOWGIVERTO);
  feedbackResponseComment.showCommentTo=new ArrayList<FeedbackParticipantType>();
  if (showCommentTo != null && !showCommentTo.isEmpty()) {
    String[] showCommentToArray=showCommentTo.split("String_Node_Str");
    for (    String viewer : showCommentToArray) {
      feedbackResponseComment.showCommentTo.add(FeedbackParticipantType.valueOf(viewer.trim()));
    }
  }
  feedbackResponseComment.showGiverNameTo=new ArrayList<FeedbackParticipantType>();
  if (showGiverNameTo != null && !showGiverNameTo.isEmpty()) {
    String[] showGiverNameToArray=showGiverNameTo.split("String_Node_Str");
    for (    String viewer : showGiverNameToArray) {
      feedbackResponseComment.showGiverNameTo.add(FeedbackParticipantType.valueOf(viewer.trim()));
    }
  }
  FeedbackResponseCommentAttributes createdComment=new FeedbackResponseCommentAttributes();
  try {
    createdComment=logic.createFeedbackResponseComment(feedbackResponseComment);
    logic.putDocument(createdComment);
  }
 catch (  InvalidParametersException e) {
    setStatusForException(e);
    data.errorMessage=e.getMessage();
    data.isError=true;
  }
  if (!data.isError) {
    statusToAdmin+="String_Node_Str" + "String_Node_Str" + feedbackResponseComment.feedbackResponseId + "String_Node_Str"+ "String_Node_Str"+ feedbackResponseComment.courseId+ "String_Node_Str"+ feedbackResponseComment.feedbackSessionName+ "String_Node_Str"+ "String_Node_Str"+ feedbackResponseComment.giverEmail+ "String_Node_Str"+ feedbackResponseComment.createdAt+ "String_Node_Str"+ "String_Node_Str"+ feedbackResponseComment.commentText.getValue();
  }
  data.comment=createdComment;
  data.commentId=commentId;
  data.showCommentToString=StringHelper.toString(createdComment.showCommentTo,"String_Node_Str");
  data.showGiverNameToString=StringHelper.toString(createdComment.showGiverNameTo,"String_Node_Str");
  return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_RESPONSE_COMMENTS_ADD,data);
}

Fixed version (ground truth):
@Override protected ActionResult execute() throws EntityDoesNotExistException {
  String courseId=getRequestParamValue(Const.ParamsNames.COURSE_ID);
  Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID,courseId);
  String feedbackSessionName=getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
  Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME,feedbackSessionName);
  String feedbackQuestionId=getRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_ID);
  Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_QUESTION_ID,feedbackQuestionId);
  String feedbackResponseId=getRequestParamValue(Const.ParamsNames.FEEDBACK_RESPONSE_ID);
  Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_RESPONSE_ID,feedbackResponseId);
  String commentId=getRequestParamValue(Const.ParamsNames.COMMENT_ID);
  Assumption.assertPostParamNotNull(Const.ParamsNames.COMMENT_ID,commentId);
  InstructorAttributes instructor=logic.getInstructorForGoogleId(courseId,account.googleId);
  FeedbackSessionAttributes session=logic.getFeedbackSession(feedbackSessionName,courseId);
  FeedbackResponseAttributes response=logic.getFeedbackResponse(feedbackResponseId);
  Assumption.assertNotNull(response);
  boolean isCreatorOnly=true;
  gateKeeper.verifyAccessible(instructor,session,!isCreatorOnly,response.giverSection,Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS);
  gateKeeper.verifyAccessible(instructor,session,!isCreatorOnly,response.recipientSection,Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS);
  InstructorFeedbackResponseCommentAjaxPageData data=new InstructorFeedbackResponseCommentAjaxPageData(account,sessionToken);
  String giverEmail=response.giver;
  String recipientEmail=response.recipient;
  FeedbackSessionResultsBundle bundle=logic.getFeedbackSessionResultsForInstructor(feedbackSessionName,courseId,instructor.email);
  String giverName=bundle.getGiverNameForResponse(response);
  String giverTeamName=bundle.getTeamNameForEmail(giverEmail);
  data.giverName=bundle.appendTeamNameToName(giverName,giverTeamName);
  String recipientName=bundle.getRecipientNameForResponse(response);
  String recipientTeamName=bundle.getTeamNameForEmail(recipientEmail);
  data.recipientName=bundle.appendTeamNameToName(recipientName,recipientTeamName);
  String commentText=getRequestParamValue(Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT);
  Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT,commentText);
  if (commentText.trim().isEmpty()) {
    data.errorMessage=Const.StatusMessages.FEEDBACK_RESPONSE_COMMENT_EMPTY;
    data.isError=true;
    return createAjaxResult(data);
  }
  FeedbackResponseCommentAttributes feedbackResponseComment=new FeedbackResponseCommentAttributes(courseId,feedbackSessionName,feedbackQuestionId,instructor.email,feedbackResponseId,new Date(),new Text(commentText),response.giverSection,response.recipientSection);
  String showCommentTo=getRequestParamValue(Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO);
  String showGiverNameTo=getRequestParamValue(Const.ParamsNames.RESPONSE_COMMENTS_SHOWGIVERTO);
  feedbackResponseComment.showCommentTo=new ArrayList<FeedbackParticipantType>();
  if (showCommentTo != null && !showCommentTo.isEmpty()) {
    String[] showCommentToArray=showCommentTo.split("String_Node_Str");
    for (    String viewer : showCommentToArray) {
      feedbackResponseComment.showCommentTo.add(FeedbackParticipantType.valueOf(viewer.trim()));
    }
  }
  feedbackResponseComment.showGiverNameTo=new ArrayList<FeedbackParticipantType>();
  if (showGiverNameTo != null && !showGiverNameTo.isEmpty()) {
    String[] showGiverNameToArray=showGiverNameTo.split("String_Node_Str");
    for (    String viewer : showGiverNameToArray) {
      feedbackResponseComment.showGiverNameTo.add(FeedbackParticipantType.valueOf(viewer.trim()));
    }
  }
  FeedbackResponseCommentAttributes createdComment=new FeedbackResponseCommentAttributes();
  try {
    createdComment=logic.createFeedbackResponseComment(feedbackResponseComment);
    logic.putDocument(createdComment);
  }
 catch (  InvalidParametersException e) {
    setStatusForException(e);
    data.errorMessage=e.getMessage();
    data.isError=true;
  }
  if (!data.isError) {
    statusToAdmin+="String_Node_Str" + "String_Node_Str" + feedbackResponseComment.feedbackResponseId + "String_Node_Str"+ "String_Node_Str"+ feedbackResponseComment.courseId+ "String_Node_Str"+ feedbackResponseComment.feedbackSessionName+ "String_Node_Str"+ "String_Node_Str"+ feedbackResponseComment.giverEmail+ "String_Node_Str"+ feedbackResponseComment.createdAt+ "String_Node_Str"+ "String_Node_Str"+ feedbackResponseComment.commentText.getValue();
  }
  data.comment=createdComment;
  data.commentId=commentId;
  data.showCommentToString=StringHelper.toString(createdComment.showCommentTo,"String_Node_Str");
  data.showGiverNameToString=StringHelper.toString(createdComment.showGiverNameTo,"String_Node_Str");
  data.question=logic.getFeedbackQuestion(feedbackQuestionId);
  return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_RESPONSE_COMMENTS_ADD,data);
}