Program: 62808
Project: 62808
Buggy source:
@Override public ActionResult execute() throws EntityDoesNotExistException {
  String courseId=getRequestParamValue(Const.ParamsNames.COURSE_ID);
  Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID,courseId);
  String studentEmail=getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL);
  Assumption.assertPostParamNotNull(Const.ParamsNames.STUDENT_EMAIL,studentEmail);
  InstructorAttributes instructor=logic.getInstructorForGoogleId(courseId,account.googleId);
  new GateKeeper().verifyAccessible(instructor,logic.getCourse(courseId),Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT);
  InstructorCourseStudentDetailsEditPageData data=new InstructorCourseStudentDetailsEditPageData(account);
  data.student=logic.getStudentForEmail(courseId,studentEmail);
  data.regKey=logic.getEncryptedKeyForStudent(courseId,studentEmail);
  data.hasSection=logic.hasIndicatedSections(courseId);
  data.student.name=getRequestParamValue(Const.ParamsNames.STUDENT_NAME);
  data.student.email=getRequestParamValue(Const.ParamsNames.NEW_STUDENT_EMAIL);
  data.student.team=getRequestParamValue(Const.ParamsNames.TEAM_NAME);
  data.student.section=getRequestParamValue(Const.ParamsNames.SECTION_NAME);
  data.student.comments=getRequestParamValue(Const.ParamsNames.COMMENTS);
  data.student.name=Sanitizer.sanitizeName(data.student.name);
  data.student.email=Sanitizer.sanitizeEmail(data.student.email);
  data.student.team=Sanitizer.sanitizeName(data.student.team);
  data.student.section=Sanitizer.sanitizeName(data.student.section);
  data.student.comments=Sanitizer.sanitizeTextField(data.student.comments);
  try {
    data.student.updateWithExistingRecord(logic.getStudentForEmail(courseId,studentEmail));
    logic.validateSections(Arrays.asList(data.student),courseId);
    logic.updateStudent(studentEmail,data.student);
    statusToUser.add(Const.StatusMessages.STUDENT_EDITED);
    statusToAdmin="String_Node_Str" + studentEmail + "String_Node_Str"+ courseId+ "String_Node_Str"+ "String_Node_Str"+ data.student.email+ "String_Node_Str"+ data.student.team+ "String_Node_Str"+ data.student.comments;
    RedirectResult result=createRedirectResult(Const.ActionURIs.INSTRUCTOR_COURSE_DETAILS_PAGE);
    result.addResponseParam(Const.ParamsNames.COURSE_ID,courseId);
    return result;
  }
 catch (  InvalidParametersException|EnrollException e) {
    setStatusForException(e);
    data.newEmail=data.student.email;
    data.student.email=studentEmail;
    return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_STUDENT_EDIT,data);
  }
}

Fixed version (ground truth):
@Override public ActionResult execute() throws EntityDoesNotExistException {
  String courseId=getRequestParamValue(Const.ParamsNames.COURSE_ID);
  Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID,courseId);
  String studentEmail=getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL);
  Assumption.assertPostParamNotNull(Const.ParamsNames.STUDENT_EMAIL,studentEmail);
  InstructorAttributes instructor=logic.getInstructorForGoogleId(courseId,account.googleId);
  new GateKeeper().verifyAccessible(instructor,logic.getCourse(courseId),Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT);
  InstructorCourseStudentDetailsEditPageData data=new InstructorCourseStudentDetailsEditPageData(account);
  StudentAttributes student=logic.getStudentForEmail(courseId,studentEmail);
  data.hasSection=logic.hasIndicatedSections(courseId);
  student.name=getRequestParamValue(Const.ParamsNames.STUDENT_NAME);
  student.email=getRequestParamValue(Const.ParamsNames.NEW_STUDENT_EMAIL);
  student.team=getRequestParamValue(Const.ParamsNames.TEAM_NAME);
  student.section=getRequestParamValue(Const.ParamsNames.SECTION_NAME);
  student.comments=getRequestParamValue(Const.ParamsNames.COMMENTS);
  student.name=Sanitizer.sanitizeName(student.name);
  student.email=Sanitizer.sanitizeEmail(student.email);
  student.team=Sanitizer.sanitizeName(student.team);
  student.section=Sanitizer.sanitizeName(student.section);
  student.comments=Sanitizer.sanitizeTextField(student.comments);
  try {
    student.updateWithExistingRecord(logic.getStudentForEmail(courseId,studentEmail));
    logic.validateSections(Arrays.asList(student),courseId);
    logic.updateStudent(studentEmail,student);
    statusToUser.add(Const.StatusMessages.STUDENT_EDITED);
    statusToAdmin="String_Node_Str" + studentEmail + "String_Node_Str"+ courseId+ "String_Node_Str"+ "String_Node_Str"+ student.email+ "String_Node_Str"+ student.team+ "String_Node_Str"+ student.comments;
    RedirectResult result=createRedirectResult(Const.ActionURIs.INSTRUCTOR_COURSE_DETAILS_PAGE);
    result.addResponseParam(Const.ParamsNames.COURSE_ID,courseId);
    return result;
  }
 catch (  InvalidParametersException|EnrollException e) {
    setStatusForException(e);
    data.newEmail=student.email;
    student.email=studentEmail;
    data.init(student,data.newEmail,data.hasSection);
    return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_STUDENT_EDIT,data);
  }
}