Program: 155441
Project: 155441
Buggy source:
private void acceptResponse(HttpServletRequest request,HttpServletResponse response){
  PersonManager pManager=new PersonManagerSession();
  AccountManager aManager=new AccountManagerSession();
  DivisionOfficeManager dManager=new DivisionOfficeManagerSession();
  Person person;
  if (name != null && designation != null && username != null && password != null && reenterPassword != null && password.equalsIgnoreCase(reenterPassword)) {
    if (title != null && !title.equalsIgnoreCase("String_Node_Str") && !title.isEmpty())     person=new Person(title,name);
 else     person=new Person(name);
    if (emailad != null && !emailad.equalsIgnoreCase("String_Node_Str") && !emailad.isEmpty()) {
      Contact email=new Contact(entry.spaceTrimmer(emailad),ContactType.EMAIL);
      person.addContact(email);
    }
    if (landline != null && !landline.equalsIgnoreCase("String_Node_Str") && !landline.isEmpty()) {
      Contact landline2=new Contact(entry.spaceTrimmer(landline),ContactType.LANDLINE);
      person.addContact(landline2);
    }
    if (mobileNumber != null && !mobileNumber.equalsIgnoreCase("String_Node_Str") && !mobileNumber.isEmpty()) {
      Contact mobile=new Contact(entry.spaceTrimmer(mobileNumber),ContactType.MOBILE);
      person.addContact(mobile);
    }
    try {
      pManager.addPerson(person);
      request.setAttribute("String_Node_Str",person);
    }
 catch (    TransactionException e) {
      failedResponse(request,response);
    }
catch (    DuplicateEntryException e) {
      failedResponse(request,response);
    }
    ArrayList<Employee> empList=new ArrayList<Employee>();
    for (int i=0; i < designation.length; i++) {
      if (designation[i].isEmpty())       continue;
      Employee employee=new Employee(entry.spaceTrimmer(designation[i]),entry.spaceTrimmer(employeeNo[i]),person);
      try {
        employee.setDivisionOffice(dManager.getDivisionOffice(Integer.parseInt(divisionOfficeID[i])));
        pManager.addEmployee(employee);
        empList.add(employee);
      }
 catch (      NumberFormatException e) {
        failedResponse(request,response);
      }
catch (      TransactionException e) {
        failedResponse(request,response);
      }
catch (      DuplicateEntryException e) {
        failedResponse(request,response);
      }
catch (      Exception e) {
        e.printStackTrace();
        failedResponse(request,response);
      }
    }
    request.setAttribute("String_Node_Str",empList);
    try {
      Account account=new Account();
      account.setPassword(password);
      account.setUsername(username);
      account.setPerson(person);
      if (acctType.equalsIgnoreCase(AccountType.NON_SPSO_PERSONNEL_EMPLOYEE.toString())) {
        account.setType(AccountType.NON_SPSO_PERSONNEL_EMPLOYEE);
      }
 else       if (acctType.equalsIgnoreCase(AccountType.NON_SPSO_PERSONNEL_HEAD.toString())) {
        account.setType(AccountType.NON_SPSO_PERSONNEL_HEAD);
      }
 else       if (acctType.equalsIgnoreCase(AccountType.SPSO_PERSONNEL.toString())) {
        account.setType(AccountType.SPSO_PERSONNEL);
      }
 else       if (acctType.equalsIgnoreCase(AccountType.SYSTEM_ADMIN.toString())) {
        account.setType(AccountType.SYSTEM_ADMIN);
      }
      aManager.addAccount(account);
      request.setAttribute("String_Node_Str",username);
      AccountsViewAction view=new AccountsViewAction();
      view.process(request,response);
    }
 catch (    TransactionException e) {
      failedResponse(request,response);
    }
catch (    ServletException e) {
      failedResponse(request,response);
    }
catch (    IOException e) {
      failedResponse(request,response);
    }
  }
}

Fixed version (ground truth):
private void acceptResponse(HttpServletRequest request,HttpServletResponse response){
  PersonManager pManager=new PersonManagerSession();
  AccountManager aManager=new AccountManagerSession();
  DivisionOfficeManager dManager=new DivisionOfficeManagerSession();
  Person person;
  if (name != null && designation != null && username != null && password != null && reenterPassword != null && password.equalsIgnoreCase(reenterPassword)) {
    if (title != null && !title.equalsIgnoreCase("String_Node_Str") && !title.isEmpty())     person=new Person(title,name);
 else     person=new Person(name);
    if (emailad != null && !emailad.equalsIgnoreCase("String_Node_Str") && !emailad.isEmpty()) {
      Contact email=new Contact(entry.spaceTrimmer(emailad),ContactType.EMAIL);
      person.addContact(email);
    }
    if (landline != null && !landline.equalsIgnoreCase("String_Node_Str") && !landline.isEmpty()) {
      Contact landline2=new Contact(entry.spaceTrimmer(landline),ContactType.LANDLINE);
      person.addContact(landline2);
    }
    if (mobileNumber != null && !mobileNumber.equalsIgnoreCase("String_Node_Str") && !mobileNumber.isEmpty()) {
      Contact mobile=new Contact(entry.spaceTrimmer(mobileNumber),ContactType.MOBILE);
      person.addContact(mobile);
    }
    try {
      pManager.addPerson(person);
      request.setAttribute("String_Node_Str",person);
    }
 catch (    TransactionException e) {
      failedResponse(request,response);
    }
catch (    DuplicateEntryException e) {
      failedResponse(request,response);
    }
    ArrayList<Employee> empList=new ArrayList<Employee>();
    for (int i=0; i < designation.length; i++) {
      if (designation[i].isEmpty())       continue;
      Employee employee=new Employee(entry.spaceTrimmer(designation[i]),entry.spaceTrimmer(employeeNo[i]),person);
      try {
        employee.setDivisionOffice(dManager.getDivisionOffice(Integer.parseInt(divisionOfficeID[i])));
        pManager.addEmployee(employee);
        empList.add(employee);
      }
 catch (      NumberFormatException e) {
        failedResponse(request,response);
      }
catch (      TransactionException e) {
        failedResponse(request,response);
      }
catch (      DuplicateEntryException e) {
        failedResponse(request,response);
      }
catch (      Exception e) {
        e.printStackTrace();
        failedResponse(request,response);
      }
    }
    request.setAttribute("String_Node_Str",empList);
    try {
      Account account=new Account();
      account.setPassword(password);
      account.setUsername(username);
      account.setPerson(person);
      if (acctType.equalsIgnoreCase(AccountType.NON_SPSO_PERSONNEL_EMPLOYEE.toString())) {
        account.setType(AccountType.NON_SPSO_PERSONNEL_EMPLOYEE);
      }
 else       if (acctType.equalsIgnoreCase(AccountType.NON_SPSO_PERSONNEL_HEAD.toString())) {
        account.setType(AccountType.NON_SPSO_PERSONNEL_HEAD);
      }
 else       if (acctType.equalsIgnoreCase(AccountType.SPSO_PERSONNEL.toString())) {
        account.setType(AccountType.SPSO_PERSONNEL);
      }
 else       if (acctType.equalsIgnoreCase(AccountType.SYSTEM_ADMIN.toString())) {
        account.setType(AccountType.SYSTEM_ADMIN);
      }
      aManager.addAccount(account);
      AccountsViewAction view=new AccountsViewAction();
      view.process(request,response);
    }
 catch (    TransactionException e) {
      failedResponse(request,response);
    }
catch (    ServletException e) {
      failedResponse(request,response);
    }
catch (    IOException e) {
      failedResponse(request,response);
    }
  }
}