Program: 144372
Project: 144372
Buggy source:
public String addDocumentsInput(){
  System.out.println("String_Node_Str" + orderIdParam);
  System.out.println("String_Node_Str" + documentStageParam);
  Orders orderEntity=orderService.findOrdersById(orderIdParam);
  order=transformToOrderFormBean(orderEntity);
  List<OrderItems> orderItemsList=operationsService.findAllOrderItemsByOrderId(orderEntity.getOrderId());
  List<String> vendorOrigin=new ArrayList<String>();
  List<String> vendorDestination=new ArrayList<String>();
  Integer vendorOriginCount=0;
  for (  OrderItems everyItem : orderItemsList) {
    if (vendorOrigin.isEmpty()) {
      vendorOrigin.add(everyItem.getVendorOrigin());
      vendorOriginCount=vendorOriginCount + 1;
    }
 else {
      if (!vendorOrigin.contains(everyItem.getVendorOrigin())) {
        vendorOrigin.add(everyItem.getVendorOrigin());
        vendorOriginCount=vendorOriginCount + 1;
      }
    }
  }
  Integer vendorDestinationCount=0;
  for (  OrderItems everyItem : orderItemsList) {
    if (vendorDestination.isEmpty()) {
      vendorDestination.add(everyItem.getVendorDestination());
      vendorDestinationCount=vendorDestinationCount + 1;
    }
 else {
      if (!vendorDestination.contains(everyItem.getVendorDestination())) {
        vendorDestination.add(everyItem.getVendorDestination());
        vendorDestinationCount=vendorDestinationCount + 1;
      }
    }
  }
  documentNames=parameterService.getParameterMap(ParameterConstants.DOCUMENT,ParameterConstants.DOCUMENT_NAME);
  List<Driver> allDriverList=vendorService.findAllDrivers();
  if (documentStageParam.equals("String_Node_Str")) {
    Vendor ernestRecipientOri=vendorService.findErnestRecipient("String_Node_Str",orderEntity.getOriginationPort());
    Vendor ernestRecipientDes=vendorService.findErnestRecipient("String_Node_Str",orderEntity.getDestinationPort());
    vendorLocationFlag="String_Node_Str";
    for (    Driver driverElem : allDriverList) {
      if (driverElem.getVendorId() == ernestRecipientOri.getVendorId()) {
        DriverBean formBean=new DriverBean();
        formBean.setDriverId(driverElem.getDriverId());
        formBean.setLastName(driverElem.getLastName());
        formBean.setFirstName(driverElem.getFirstName());
        formBean.setAuthorizedAgent(ernestRecipientOri.getVendorName() + "String_Node_Str" + driverElem.getFirstName()+ "String_Node_Str"+ driverElem.getLastName());
        repContactsList.add(formBean);
      }
    }
    for (    String driverOrigin : vendorOrigin) {
      Vendor vendorEntity=vendorService.findVendorByVendorCode(driverOrigin);
      for (      Driver driverElem : allDriverList) {
        if (driverElem.getVendorId() == vendorEntity.getVendorId()) {
          DriverBean formBean=new DriverBean();
          formBean.setDriverId(driverElem.getDriverId());
          formBean.setLastName(driverElem.getLastName());
          formBean.setFirstName(driverElem.getFirstName());
          Vendor insideEntity=vendorService.findVendorById(driverElem.getVendorId());
          formBean.setAuthorizedAgent(insideEntity.getVendorName() + "String_Node_Str" + driverElem.getFirstName()+ "String_Node_Str"+ driverElem.getLastName());
          repContactsList.add(formBean);
        }
      }
    }
    shipperContacts=vendorService.findContactByReferenceId(ernestRecipientOri.getVendorId());
    consigneeContacts=vendorService.findContactByReferenceId(ernestRecipientDes.getVendorId());
  }
 else   if (documentStageParam.equals("String_Node_Str")) {
    Vendor ernestRecipientOri=vendorService.findErnestRecipient("String_Node_Str",orderEntity.getOriginationPort());
    Vendor ernestRecipientDes=vendorService.findErnestRecipient("String_Node_Str",orderEntity.getDestinationPort());
    vendorLocationFlag="String_Node_Str";
    for (    Driver driverElem : allDriverList) {
      if (driverElem.getVendorId() == ernestRecipientDes.getVendorId()) {
        DriverBean formBean=new DriverBean();
        formBean.setDriverId(driverElem.getDriverId());
        formBean.setLastName(driverElem.getLastName());
        formBean.setFirstName(driverElem.getFirstName());
        formBean.setAuthorizedAgent(ernestRecipientDes.getVendorName() + "String_Node_Str" + driverElem.getFirstName()+ "String_Node_Str"+ driverElem.getLastName());
        repContactsList.add(formBean);
      }
    }
    for (    String driverDestination : vendorDestination) {
      Vendor vendorEntity=vendorService.findVendorByVendorCode(driverDestination);
      for (      Driver driverElem : allDriverList) {
        if (driverElem.getVendorId() == vendorEntity.getVendorId()) {
          DriverBean formBean=new DriverBean();
          formBean.setDriverId(driverElem.getDriverId());
          formBean.setDriverCode(driverElem.getDriverCode());
          formBean.setLicenseNumber(driverElem.getLicenseNumber());
          formBean.setLastName(driverElem.getLastName());
          formBean.setFirstName(driverElem.getFirstName());
          formBean.setMiddleName(driverElem.getMiddleName());
          formBean.setTitle(driverElem.getTitle());
          formBean.setStatus(driverElem.getStatus());
          formBean.setCreatedBy(driverElem.getCreatedBy());
          formBean.setCreatedTimeStamp(driverElem.getCreatedTimestamp());
          Vendor insideEntity=vendorService.findVendorById(driverElem.getVendorId());
          formBean.setAuthorizedAgent(insideEntity.getVendorName() + "String_Node_Str" + driverElem.getFirstName()+ "String_Node_Str"+ driverElem.getLastName());
          repContactsList.add(formBean);
        }
      }
    }
    shipperContacts=vendorService.findContactByReferenceId(ernestRecipientOri.getVendorId());
    consigneeContacts=vendorService.findContactByReferenceId(ernestRecipientDes.getVendorId());
  }
  return SUCCESS;
}

Fixed version (ground truth):
public String addDocumentsInput(){
  System.out.println("String_Node_Str" + orderIdParam);
  System.out.println("String_Node_Str" + documentStageParam);
  Orders orderEntity=orderService.findOrdersById(orderIdParam);
  order=transformToOrderFormBean(orderEntity);
  List<OrderItems> orderItemsList=operationsService.findAllOrderItemsByOrderId(orderEntity.getOrderId());
  List<String> vendorOrigin=new ArrayList<String>();
  List<String> vendorDestination=new ArrayList<String>();
  Integer vendorOriginCount=0;
  for (  OrderItems everyItem : orderItemsList) {
    if (vendorOrigin.isEmpty()) {
      vendorOrigin.add(everyItem.getVendorOrigin());
      vendorOriginCount=vendorOriginCount + 1;
    }
 else {
      if (!vendorOrigin.contains(everyItem.getVendorOrigin())) {
        vendorOrigin.add(everyItem.getVendorOrigin());
        vendorOriginCount=vendorOriginCount + 1;
      }
    }
  }
  Integer vendorDestinationCount=0;
  for (  OrderItems everyItem : orderItemsList) {
    if (vendorDestination.isEmpty()) {
      vendorDestination.add(everyItem.getVendorDestination());
      vendorDestinationCount=vendorDestinationCount + 1;
    }
 else {
      if (!vendorDestination.contains(everyItem.getVendorDestination())) {
        vendorDestination.add(everyItem.getVendorDestination());
        vendorDestinationCount=vendorDestinationCount + 1;
      }
    }
  }
  documentNames=parameterService.getParameterMap(ParameterConstants.DOCUMENT,ParameterConstants.DOCUMENT_NAME);
  List<Driver> allDriverList=vendorService.findAllDrivers();
  if (documentStageParam.equals("String_Node_Str")) {
    Vendor ernestRecipientOri=vendorService.findErnestRecipient("String_Node_Str",orderEntity.getOriginationPort());
    Vendor ernestRecipientDes=vendorService.findErnestRecipient("String_Node_Str",orderEntity.getDestinationPort());
    vendorLocationFlag="String_Node_Str";
    for (    Driver driverElem : allDriverList) {
      if (driverElem.getVendorId() == ernestRecipientOri.getVendorId()) {
        DriverBean formBean=new DriverBean();
        formBean.setDriverId(driverElem.getDriverId());
        formBean.setLastName(driverElem.getLastName());
        formBean.setFirstName(driverElem.getFirstName());
        formBean.setAuthorizedAgent(ernestRecipientOri.getVendorName() + "String_Node_Str" + driverElem.getFirstName()+ "String_Node_Str"+ driverElem.getLastName());
        repContactsList.add(formBean);
      }
    }
    for (    String driverOrigin : vendorOrigin) {
      Vendor vendorEntity=vendorService.findVendorByVendorCode(driverOrigin);
      if (vendorEntity != null) {
        for (        Driver driverElem : allDriverList) {
          if (driverElem.getVendorId() == vendorEntity.getVendorId()) {
            DriverBean formBean=new DriverBean();
            formBean.setDriverId(driverElem.getDriverId());
            formBean.setLastName(driverElem.getLastName());
            formBean.setFirstName(driverElem.getFirstName());
            Vendor insideEntity=vendorService.findVendorById(driverElem.getVendorId());
            formBean.setAuthorizedAgent(insideEntity.getVendorName() + "String_Node_Str" + driverElem.getFirstName()+ "String_Node_Str"+ driverElem.getLastName());
            repContactsList.add(formBean);
          }
        }
      }
    }
    if (ernestRecipientOri != null) {
      shipperContacts=vendorService.findContactByReferenceId(ernestRecipientOri.getVendorId());
    }
    if (ernestRecipientDes != null) {
      consigneeContacts=vendorService.findContactByReferenceId(ernestRecipientDes.getVendorId());
    }
  }
 else   if (documentStageParam.equals("String_Node_Str")) {
    Vendor ernestRecipientOri=vendorService.findErnestRecipient("String_Node_Str",orderEntity.getOriginationPort());
    Vendor ernestRecipientDes=vendorService.findErnestRecipient("String_Node_Str",orderEntity.getDestinationPort());
    vendorLocationFlag="String_Node_Str";
    for (    Driver driverElem : allDriverList) {
      if (driverElem.getVendorId() == ernestRecipientDes.getVendorId()) {
        DriverBean formBean=new DriverBean();
        formBean.setDriverId(driverElem.getDriverId());
        formBean.setLastName(driverElem.getLastName());
        formBean.setFirstName(driverElem.getFirstName());
        formBean.setAuthorizedAgent(ernestRecipientDes.getVendorName() + "String_Node_Str" + driverElem.getFirstName()+ "String_Node_Str"+ driverElem.getLastName());
        repContactsList.add(formBean);
      }
    }
    for (    String driverDestination : vendorDestination) {
      Vendor vendorEntity=vendorService.findVendorByVendorCode(driverDestination);
      if (vendorEntity != null) {
        for (        Driver driverElem : allDriverList) {
          if (driverElem.getVendorId() == vendorEntity.getVendorId()) {
            DriverBean formBean=new DriverBean();
            formBean.setDriverId(driverElem.getDriverId());
            formBean.setDriverCode(driverElem.getDriverCode());
            formBean.setLicenseNumber(driverElem.getLicenseNumber());
            formBean.setLastName(driverElem.getLastName());
            formBean.setFirstName(driverElem.getFirstName());
            formBean.setMiddleName(driverElem.getMiddleName());
            formBean.setTitle(driverElem.getTitle());
            formBean.setStatus(driverElem.getStatus());
            formBean.setCreatedBy(driverElem.getCreatedBy());
            formBean.setCreatedTimeStamp(driverElem.getCreatedTimestamp());
            Vendor insideEntity=vendorService.findVendorById(driverElem.getVendorId());
            formBean.setAuthorizedAgent(insideEntity.getVendorName() + "String_Node_Str" + driverElem.getFirstName()+ "String_Node_Str"+ driverElem.getLastName());
            repContactsList.add(formBean);
          }
        }
      }
    }
    if (ernestRecipientOri != null) {
      shipperContacts=vendorService.findContactByReferenceId(ernestRecipientOri.getVendorId());
    }
    if (ernestRecipientDes != null) {
      consigneeContacts=vendorService.findContactByReferenceId(ernestRecipientDes.getVendorId());
    }
  }
  return SUCCESS;
}