Program: 93063
Project: 93063
Buggy source:
public SearchProcessResult findPerson(int targetServer,PersonWrapper searchPersonWrapper,boolean lastResort){
  if (targetServer == Server.MPI_LPI) {
    session.setMpiResultDisplayed(false);
    session.setLpiResultDisplayed(false);
  }
  if (targetServer == Server.MPI) {
    session.setMpiResultDisplayed(false);
  }
  if (targetServer == Server.LPI) {
    session.setLpiResultDisplayed(false);
  }
  if (!lastResort) {
    session.setRejectedMPICandidateList(null);
    session.setRejectedLPICandidateList(null);
  }
  List<Person> mpiPersonList=null;
  List<Person> lpiPersonList=null;
  session.setSearchPersonWrapper(searchPersonWrapper);
  RequestResult mpiRequestResult=session.getMpiRequestResult();
  RequestResult lpiRequestResult=session.getLpiRequestResult();
  RequestDispatcher.dispatch(createPersonRequest(searchPersonWrapper),mpiRequestResult,lpiRequestResult,RequestDispatcher.DispatchType.FIND,targetServer);
  if (mpiRequestResult.isSuccessful() && lpiRequestResult.isSuccessful()) {
    mpiPersonList=(List<Person>)mpiRequestResult.getData();
    lpiPersonList=(List<Person>)lpiRequestResult.getData();
    if (checkForLinkedCandidates(lpiPersonList)) {
      return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.LPI,removeRejectedLpiCandidates(lpiPersonList)));
    }
 else {
      if (checkForFingerprintCandidates(mpiPersonList)) {
        return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.MPI,removeRejectedMpiCandidates(mpiPersonList)));
      }
 else {
        if (!minimumSearchFingerprintsTaken()) {
          return new SearchProcessResult(SearchProcessResult.Type.NEXT_FINGERPRINT,null);
        }
 else {
          if (!session.getAnyUnsentFingerprints().isEmpty()) {
            for (            ImagedFingerprint imagedFingerprint : session.getAnyUnsentFingerprints()) {
              session.setActiveImagedFingerprint(imagedFingerprint);
              searchPersonWrapper.addFingerprint(imagedFingerprint);
              break;
            }
            return findPerson(Server.MPI_LPI,searchPersonWrapper);
          }
 else {
            if (!removeRejectedLpiCandidates(lpiPersonList).isEmpty()) {
              return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.LPI,lpiPersonList));
            }
 else {
              if (!removeRejectedMpiCandidates(mpiPersonList).isEmpty()) {
                return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.MPI,mpiPersonList));
              }
 else {
                return new SearchProcessResult(SearchProcessResult.Type.EXIT,null);
              }
            }
          }
        }
      }
    }
  }
 else {
    if (!mpiRequestResult.isSuccessful() && !lpiRequestResult.isSuccessful()) {
      if (mainView.showConfirmMessage("String_Node_Str" + "String_Node_Str",((MainView)mainView).getFrame())) {
        return findPerson(Server.MPI_LPI,searchPersonWrapper);
      }
    }
 else {
      if (!mpiRequestResult.isSuccessful() && lpiRequestResult.isSuccessful()) {
        lpiPersonList=(List<Person>)lpiRequestResult.getData();
        if (mainView.showConfirmMessage("String_Node_Str" + "String_Node_Str",((MainView)mainView).getFrame())) {
          return findPerson(Server.MPI,searchPersonWrapper);
        }
        if (!removeRejectedLpiCandidates(lpiPersonList).isEmpty()) {
          return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.LPI,lpiPersonList));
        }
 else {
          return new SearchProcessResult(SearchProcessResult.Type.EXIT,null);
        }
      }
 else       if (!lpiRequestResult.isSuccessful() && mpiRequestResult.isSuccessful()) {
        mpiPersonList=(List<Person>)mpiRequestResult.getData();
        if (mainView.showConfirmMessage("String_Node_Str" + "String_Node_Str",((MainView)mainView).getFrame())) {
          return findPerson(Server.LPI,searchPersonWrapper);
        }
        if (!removeRejectedMpiCandidates(mpiPersonList).isEmpty()) {
          return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.MPI,mpiPersonList));
        }
 else {
          return new SearchProcessResult(SearchProcessResult.Type.EXIT,null);
        }
      }
    }
    return new SearchProcessResult(SearchProcessResult.Type.UNREACHABLE_SERVER,null);
  }
}

Fixed version (ground truth):
public SearchProcessResult findPerson(int targetServer,PersonWrapper searchPersonWrapper,boolean lastResort){
  if (targetServer == Server.MPI_LPI) {
    session.setMpiResultDisplayed(false);
    session.setLpiResultDisplayed(false);
  }
  if (targetServer == Server.MPI) {
    session.setMpiResultDisplayed(false);
  }
  if (targetServer == Server.LPI) {
    session.setLpiResultDisplayed(false);
  }
  if (!lastResort) {
    session.setRejectedMPICandidateList(null);
    session.setRejectedLPICandidateList(null);
  }
  List<Person> mpiPersonList=null;
  List<Person> lpiPersonList=null;
  session.setSearchPersonWrapper(searchPersonWrapper);
  RequestResult mpiRequestResult=session.getMpiRequestResult();
  RequestResult lpiRequestResult=session.getLpiRequestResult();
  RequestDispatcher.dispatch(createPersonRequest(searchPersonWrapper),mpiRequestResult,lpiRequestResult,RequestDispatcher.DispatchType.FIND,targetServer);
  if (mpiRequestResult.isSuccessful() && lpiRequestResult.isSuccessful()) {
    mpiPersonList=(List<Person>)mpiRequestResult.getData();
    lpiPersonList=(List<Person>)lpiRequestResult.getData();
    if (!lastResort || (lastResort && targetServer == Server.MPI_LPI)) {
      if (checkForLinkedCandidates(lpiPersonList)) {
        return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.LPI,removeRejectedLpiCandidates(lpiPersonList)));
      }
 else {
        if (checkForFingerprintCandidates(mpiPersonList)) {
          return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.MPI,removeRejectedMpiCandidates(mpiPersonList)));
        }
 else {
          if (!minimumSearchFingerprintsTaken()) {
            return new SearchProcessResult(SearchProcessResult.Type.NEXT_FINGERPRINT,null);
          }
 else {
            if (!session.getAnyUnsentFingerprints().isEmpty()) {
              for (              ImagedFingerprint imagedFingerprint : session.getAnyUnsentFingerprints()) {
                session.setActiveImagedFingerprint(imagedFingerprint);
                searchPersonWrapper.addFingerprint(imagedFingerprint);
                break;
              }
              return findPerson(Server.MPI_LPI,searchPersonWrapper);
            }
 else {
              if (!removeRejectedLpiCandidates(lpiPersonList).isEmpty()) {
                return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.LPI,lpiPersonList));
              }
 else {
                if (!removeRejectedMpiCandidates(mpiPersonList).isEmpty()) {
                  return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.MPI,mpiPersonList));
                }
 else {
                  return new SearchProcessResult(SearchProcessResult.Type.EXIT,null);
                }
              }
            }
          }
        }
      }
    }
 else     if (lastResort && targetServer == Server.MPI) {
      if (!removeRejectedMpiCandidates(mpiPersonList).isEmpty()) {
        return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.MPI,mpiPersonList));
      }
 else {
        return new SearchProcessResult(SearchProcessResult.Type.EXIT,null);
      }
    }
 else     if (lastResort && targetServer == Server.LPI) {
      if (!removeRejectedLpiCandidates(lpiPersonList).isEmpty()) {
        return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.LPI,lpiPersonList));
      }
 else {
        return new SearchProcessResult(SearchProcessResult.Type.EXIT,null);
      }
    }
 else {
      Mediator.getLogger(MainViewHelper.class.getName()).log(Level.SEVERE,"String_Node_Str");
      return new SearchProcessResult(SearchProcessResult.Type.EXIT,null);
    }
  }
 else {
    if (!lastResort) {
      if (!mpiRequestResult.isSuccessful() && !lpiRequestResult.isSuccessful()) {
        if (mainView.showConfirmMessage("String_Node_Str" + "String_Node_Str",((MainView)mainView).getFrame())) {
          return findPerson(Server.MPI_LPI,searchPersonWrapper);
        }
      }
 else {
        if (!mpiRequestResult.isSuccessful() && lpiRequestResult.isSuccessful()) {
          lpiPersonList=(List<Person>)lpiRequestResult.getData();
          if (mainView.showConfirmMessage("String_Node_Str" + "String_Node_Str",((MainView)mainView).getFrame())) {
            return findPerson(Server.MPI,searchPersonWrapper);
          }
          if (!removeRejectedLpiCandidates(lpiPersonList).isEmpty()) {
            return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.LPI,lpiPersonList));
          }
 else {
            return new SearchProcessResult(SearchProcessResult.Type.EXIT,null);
          }
        }
 else         if (!lpiRequestResult.isSuccessful() && mpiRequestResult.isSuccessful()) {
          mpiPersonList=(List<Person>)mpiRequestResult.getData();
          if (mainView.showConfirmMessage("String_Node_Str" + "String_Node_Str",((MainView)mainView).getFrame())) {
            return findPerson(Server.LPI,searchPersonWrapper);
          }
          if (!removeRejectedMpiCandidates(mpiPersonList).isEmpty()) {
            return new SearchProcessResult(SearchProcessResult.Type.LIST,new SearchServerResponse(Server.MPI,mpiPersonList));
          }
 else {
            return new SearchProcessResult(SearchProcessResult.Type.EXIT,null);
          }
        }
      }
      return new SearchProcessResult(SearchProcessResult.Type.UNREACHABLE_SERVER,null);
    }
 else {
      return new SearchProcessResult(SearchProcessResult.Type.EXIT,null);
    }
  }
}