Program: 189418
Project: 189418
Buggy source:
/** 
 * The first screen of the submission process which allows the student to supply their identity, affiliation, and contact information. We default the data displayed to information from the submitter's person object if available. After successfully completing this step a new submission is persisted in the database and the user is sent on to the license step.
 * @param subId The id of the submission being edited. This may be null for this step, all other steps this id is required.
 */
@Security(RoleType.STUDENT) public static void verifyPersonalInformation(Long subId){
  if (params.get("String_Node_Str") != null)   Application.index();
  Person submitter=context.getPerson();
  Submission sub=null;
  if (subId != null) {
    sub=subRepo.findSubmission(subId);
    if (sub.getSubmitter() != submitter)     unauthorized();
  }
  String firstName=params.get("String_Node_Str");
  String middleName=params.get("String_Node_Str");
  String lastName=params.get("String_Node_Str");
  String birthYear=params.get("String_Node_Str");
  String department=params.get("String_Node_Str");
  String degree=params.get("String_Node_Str");
  String major=params.get("String_Node_Str");
  String permPhone=params.get("String_Node_Str");
  String permAddress=params.get("String_Node_Str");
  String permEmail=params.get("String_Node_Str");
  String currentEmail=params.get("String_Node_Str");
  String currentAddress=params.get("String_Node_Str");
  List<String> disabledFields=new ArrayList<String>();
  if (isFieldGroupLocked("String_Node_Str")) {
    if (submitter.getFirstName() != null) {
      disabledFields.add("String_Node_Str");
      firstName=submitter.getFirstName();
    }
    if (submitter.getMiddleName() != null) {
      disabledFields.add("String_Node_Str");
      middleName=submitter.getMiddleName();
    }
    if (submitter.getLastName() != null) {
      disabledFields.add("String_Node_Str");
      lastName=submitter.getLastName();
    }
    if (submitter.getBirthYear() != null) {
      if (submitter.getBirthYear() == null)       birthYear="String_Node_Str";
 else       birthYear=String.valueOf(submitter.getBirthYear());
      disabledFields.add("String_Node_Str");
    }
  }
  if (isFieldGroupLocked("String_Node_Str")) {
    if (isValidDepartment(submitter.getCurrentDepartment())) {
      disabledFields.add("String_Node_Str");
      department=submitter.getCurrentDepartment();
    }
    if (isValidDegree(submitter.getCurrentDegree())) {
      disabledFields.add("String_Node_Str");
      degree=submitter.getCurrentDegree();
    }
    if (isValidMajor(submitter.getCurrentMajor())) {
      disabledFields.add("String_Node_Str");
      major=submitter.getCurrentMajor();
    }
  }
  if (isFieldGroupLocked("String_Node_Str")) {
    if (submitter.getPermanentPhoneNumber() != null) {
      disabledFields.add("String_Node_Str");
      permPhone=submitter.getPermanentPhoneNumber();
    }
    if (submitter.getPermanentPostalAddress() != null) {
      disabledFields.add("String_Node_Str");
      permAddress=submitter.getPermanentEmailAddress();
    }
    if (submitter.getPermanentEmailAddress() != null) {
      try {
        new InternetAddress(submitter.getPermanentEmailAddress()).validate();
        disabledFields.add("String_Node_Str");
        permEmail=submitter.getPermanentEmailAddress();
      }
 catch (      AddressException ae) {
      }
    }
    if (submitter.getCurrentEmailAddress() != null) {
      try {
        new InternetAddress(submitter.getCurrentEmailAddress()).validate();
        disabledFields.add("String_Node_Str");
        currentEmail=submitter.getCurrentEmailAddress();
      }
 catch (      AddressException ae) {
      }
    }
    if (submitter.getCurrentPostalAddress() != null) {
      disabledFields.add("String_Node_Str");
      currentAddress=submitter.getCurrentEmailAddress();
    }
  }
  if (params.get("String_Node_Str") != null) {
    if (firstName == null || firstName.trim().length() == 0)     validation.addError("String_Node_Str","String_Node_Str");
    if (lastName == null || lastName.trim().length() == 0)     validation.addError("String_Node_Str","String_Node_Str");
    Integer birthYearInt=null;
    if (birthYear != null && birthYear.trim().length() > 0) {
      try {
        birthYearInt=Integer.valueOf(birthYear);
        if (birthYearInt < 1900 || birthYearInt > (new Date().getYear() + 1900))         validation.addError("String_Node_Str","String_Node_Str");
      }
 catch (      NumberFormatException nfe) {
        validation.addError("String_Node_Str","String_Node_Str");
      }
    }
    if (!isValidDepartment(department))     validation.addError("String_Node_Str","String_Node_Str");
    if (!isValidDegree(degree))     validation.addError("String_Node_Str","String_Node_Str");
    if (!isValidDepartment(major))     validation.addError("String_Node_Str","String_Node_Str");
    if (permPhone == null || permPhone.trim().length() == 0)     validation.addError("String_Node_Str","String_Node_Str");
    if (permAddress == null || permAddress.trim().length() == 0)     validation.addError("String_Node_Str","String_Node_Str");
    if (permEmail != null && permEmail.trim().length() > 0) {
      try {
        new InternetAddress(permEmail).validate();
      }
 catch (      AddressException ae) {
        validation.addError("String_Node_Str","String_Node_Str");
      }
    }
    if (currentEmail != null && currentEmail.trim().length() > 0) {
      try {
        new InternetAddress(currentEmail).validate();
      }
 catch (      AddressException ae) {
        validation.addError("String_Node_Str","String_Node_Str");
      }
    }
    if (!validation.hasErrors()) {
      if (sub == null)       sub=subRepo.createSubmission(submitter);
      sub.setStudentFirstName(firstName);
      sub.setStudentMiddleName(middleName);
      sub.setStudentLastName(lastName);
      sub.setStudentBirthYear(birthYearInt);
      sub.setDepartment(department);
      sub.setDegree(degree);
      sub.setMajor(major);
      submitter.setPermanentPhoneNumber(permPhone);
      submitter.setPermanentPostalAddress(permAddress);
      submitter.setPermanentEmailAddress(permEmail);
      submitter.setCurrentEmailAddress(currentEmail);
      submitter.setCurrentPostalAddress(currentAddress);
      sub.save();
      submitter.save();
      license(sub.getId());
    }
  }
 else   if (sub != null) {
    firstName=sub.getStudentFirstName();
    middleName=sub.getStudentMiddleName();
    lastName=sub.getStudentLastName();
    if (submitter.getBirthYear() == null)     birthYear="String_Node_Str";
 else     birthYear=String.valueOf(submitter.getBirthYear());
    department=sub.getDepartment();
    if (!isValidDepartment(department))     department=null;
    degree=sub.getDegree();
    if (!isValidDegree(degree))     degree=null;
    major=sub.getMajor();
    if (!isValidMajor(major))     major=null;
    permPhone=submitter.getPermanentPhoneNumber();
    permAddress=submitter.getPermanentPostalAddress();
    permEmail=submitter.getPermanentEmailAddress();
    currentEmail=submitter.getCurrentEmailAddress();
    currentAddress=submitter.getCurrentPostalAddress();
  }
 else {
    firstName=submitter.getFirstName();
    middleName=submitter.getMiddleName();
    lastName=submitter.getLastName();
    if (submitter.getBirthYear() == null)     birthYear="String_Node_Str";
 else     birthYear=String.valueOf(submitter.getBirthYear());
    department=submitter.getCurrentDepartment();
    if (!isValidDepartment(department))     department=null;
    degree=submitter.getCurrentDegree();
    if (!isValidDegree(degree))     degree=null;
    major=submitter.getCurrentMajor();
    if (!isValidMajor(major))     major=null;
    permPhone=submitter.getPermanentPhoneNumber();
    permAddress=submitter.getPermanentPostalAddress();
    permEmail=submitter.getPermanentEmailAddress();
    currentEmail=submitter.getCurrentEmailAddress();
    currentAddress=submitter.getCurrentPostalAddress();
  }
  render(submitter,subId,disabledFields,firstName,middleName,lastName,birthYear,department,degree,major,permPhone,permAddress,permEmail,currentEmail,currentAddress);
}

Fixed version (ground truth):
/** 
 * The first screen of the submission process which allows the student to supply their identity, affiliation, and contact information. We default the data displayed to information from the submitter's person object if available. After successfully completing this step a new submission is persisted in the database and the user is sent on to the license step.
 * @param subId The id of the submission being edited. This may be null for this step, all other steps this id is required.
 */
@Security(RoleType.STUDENT) public static void verifyPersonalInformation(Long subId){
  if (params.get("String_Node_Str") != null)   Application.index();
  Person submitter=context.getPerson();
  Submission sub=null;
  if (subId != null) {
    sub=subRepo.findSubmission(subId);
    if (sub.getSubmitter() != submitter)     unauthorized();
  }
  String firstName=params.get("String_Node_Str");
  String middleName=params.get("String_Node_Str");
  String lastName=params.get("String_Node_Str");
  String birthYear=params.get("String_Node_Str");
  String department=params.get("String_Node_Str");
  String degree=params.get("String_Node_Str");
  String major=params.get("String_Node_Str");
  String permPhone=params.get("String_Node_Str");
  String permAddress=params.get("String_Node_Str");
  String permEmail=params.get("String_Node_Str");
  String currentEmail=params.get("String_Node_Str");
  String currentAddress=params.get("String_Node_Str");
  List<String> disabledFields=new ArrayList<String>();
  if (isFieldGroupLocked("String_Node_Str")) {
    if (submitter.getFirstName() != null) {
      disabledFields.add("String_Node_Str");
      firstName=submitter.getFirstName();
    }
    if (submitter.getMiddleName() != null) {
      disabledFields.add("String_Node_Str");
      middleName=submitter.getMiddleName();
    }
    if (submitter.getLastName() != null) {
      disabledFields.add("String_Node_Str");
      lastName=submitter.getLastName();
    }
    if (submitter.getBirthYear() != null) {
      if (submitter.getBirthYear() == null)       birthYear="String_Node_Str";
 else       birthYear=String.valueOf(submitter.getBirthYear());
      disabledFields.add("String_Node_Str");
    }
  }
  if (isFieldGroupLocked("String_Node_Str")) {
    if (isValidDepartment(submitter.getCurrentDepartment())) {
      disabledFields.add("String_Node_Str");
      department=submitter.getCurrentDepartment();
    }
    if (isValidDegree(submitter.getCurrentDegree())) {
      disabledFields.add("String_Node_Str");
      degree=submitter.getCurrentDegree();
    }
    if (isValidMajor(submitter.getCurrentMajor())) {
      disabledFields.add("String_Node_Str");
      major=submitter.getCurrentMajor();
    }
  }
  if (isFieldGroupLocked("String_Node_Str")) {
    if (submitter.getPermanentPhoneNumber() != null) {
      disabledFields.add("String_Node_Str");
      permPhone=submitter.getPermanentPhoneNumber();
    }
    if (submitter.getPermanentPostalAddress() != null) {
      disabledFields.add("String_Node_Str");
      permAddress=submitter.getPermanentEmailAddress();
    }
    if (submitter.getPermanentEmailAddress() != null) {
      try {
        new InternetAddress(submitter.getPermanentEmailAddress()).validate();
        disabledFields.add("String_Node_Str");
        permEmail=submitter.getPermanentEmailAddress();
      }
 catch (      AddressException ae) {
      }
    }
    if (submitter.getCurrentEmailAddress() != null) {
      try {
        new InternetAddress(submitter.getCurrentEmailAddress()).validate();
        disabledFields.add("String_Node_Str");
        currentEmail=submitter.getCurrentEmailAddress();
      }
 catch (      AddressException ae) {
      }
    }
    if (submitter.getCurrentPostalAddress() != null) {
      disabledFields.add("String_Node_Str");
      currentAddress=submitter.getCurrentEmailAddress();
    }
  }
  if (params.get("String_Node_Str") != null) {
    if (firstName == null || firstName.trim().length() == 0)     validation.addError("String_Node_Str","String_Node_Str");
    if (lastName == null || lastName.trim().length() == 0)     validation.addError("String_Node_Str","String_Node_Str");
    Integer birthYearInt=null;
    if (birthYear != null && birthYear.trim().length() > 0) {
      try {
        birthYearInt=Integer.valueOf(birthYear);
        if (birthYearInt < 1900 || birthYearInt > (new Date().getYear() + 1900))         validation.addError("String_Node_Str","String_Node_Str");
      }
 catch (      NumberFormatException nfe) {
        validation.addError("String_Node_Str","String_Node_Str");
      }
    }
    if (!isValidDepartment(department))     validation.addError("String_Node_Str","String_Node_Str");
    if (!isValidDegree(degree))     validation.addError("String_Node_Str","String_Node_Str");
    if (!isValidMajor(major))     validation.addError("String_Node_Str","String_Node_Str");
    if (permPhone == null || permPhone.trim().length() == 0)     validation.addError("String_Node_Str","String_Node_Str");
    if (permAddress == null || permAddress.trim().length() == 0)     validation.addError("String_Node_Str","String_Node_Str");
    if (permEmail != null && permEmail.trim().length() > 0) {
      try {
        new InternetAddress(permEmail).validate();
      }
 catch (      AddressException ae) {
        validation.addError("String_Node_Str","String_Node_Str");
      }
    }
    if (currentEmail != null && currentEmail.trim().length() > 0) {
      try {
        new InternetAddress(currentEmail).validate();
      }
 catch (      AddressException ae) {
        validation.addError("String_Node_Str","String_Node_Str");
      }
    }
    if (!validation.hasErrors()) {
      if (sub == null)       sub=subRepo.createSubmission(submitter);
      sub.setStudentFirstName(firstName);
      sub.setStudentMiddleName(middleName);
      sub.setStudentLastName(lastName);
      sub.setStudentBirthYear(birthYearInt);
      sub.setDepartment(department);
      sub.setDegree(degree);
      sub.setMajor(major);
      submitter.setPermanentPhoneNumber(permPhone);
      submitter.setPermanentPostalAddress(permAddress);
      submitter.setPermanentEmailAddress(permEmail);
      submitter.setCurrentEmailAddress(currentEmail);
      submitter.setCurrentPostalAddress(currentAddress);
      sub.save();
      submitter.save();
      license(sub.getId());
    }
  }
 else   if (sub != null) {
    firstName=sub.getStudentFirstName();
    middleName=sub.getStudentMiddleName();
    lastName=sub.getStudentLastName();
    if (submitter.getBirthYear() == null)     birthYear="String_Node_Str";
 else     birthYear=String.valueOf(submitter.getBirthYear());
    department=sub.getDepartment();
    if (!isValidDepartment(department))     department=null;
    degree=sub.getDegree();
    if (!isValidDegree(degree))     degree=null;
    major=sub.getMajor();
    if (!isValidMajor(major))     major=null;
    permPhone=submitter.getPermanentPhoneNumber();
    permAddress=submitter.getPermanentPostalAddress();
    permEmail=submitter.getPermanentEmailAddress();
    currentEmail=submitter.getCurrentEmailAddress();
    currentAddress=submitter.getCurrentPostalAddress();
  }
 else {
    firstName=submitter.getFirstName();
    middleName=submitter.getMiddleName();
    lastName=submitter.getLastName();
    if (submitter.getBirthYear() == null)     birthYear="String_Node_Str";
 else     birthYear=String.valueOf(submitter.getBirthYear());
    department=submitter.getCurrentDepartment();
    if (!isValidDepartment(department))     department=null;
    degree=submitter.getCurrentDegree();
    if (!isValidDegree(degree))     degree=null;
    major=submitter.getCurrentMajor();
    if (!isValidMajor(major))     major=null;
    permPhone=submitter.getPermanentPhoneNumber();
    permAddress=submitter.getPermanentPostalAddress();
    permEmail=submitter.getPermanentEmailAddress();
    currentEmail=submitter.getCurrentEmailAddress();
    currentAddress=submitter.getCurrentPostalAddress();
  }
  render(submitter,subId,disabledFields,firstName,middleName,lastName,birthYear,department,degree,major,permPhone,permAddress,permEmail,currentEmail,currentAddress);
}