Program: 144380
Project: 144380
Buggy source:
public String createdInlandDocument(){
  List<Documents> freightDocuments=documentsService.findDocumentsByOrderId(orderIdParam);
  for (  Documents freightDocumentElem : freightDocuments) {
    if (freightDocumentElem.getDocumentName().equals("String_Node_Str") || freightDocumentElem.getDocumentName().equals("String_Node_Str")) {
      Documents documentEntity=documentsService.findDocumentById(freightDocumentElem.getDocumentId());
      documentsService.deleteDocument(documentEntity);
    }
  }
  List<String> vendorOrigin=new ArrayList<String>();
  List<String> vendorDestination=new ArrayList<String>();
  List<OrderItems> orderItemsList=new ArrayList<OrderItems>();
  Orders orderEntity=orderService.findOrdersById(orderIdParam);
  order=transformToOrderFormBean(orderEntity);
  orderItemsList=operationsService.findAllOrderItemsByOrderId(orderIdParam);
  for (  OrderItems everyItem : orderItemsList) {
    if (vendorOrigin.isEmpty()) {
      vendorOrigin.add(everyItem.getVendorOrigin());
    }
 else {
      if (!vendorOrigin.contains(everyItem.getVendorOrigin())) {
        vendorOrigin.add(everyItem.getVendorOrigin());
      }
    }
  }
  for (  OrderItems everyItem : orderItemsList) {
    if (vendorDestination.isEmpty()) {
      vendorDestination.add(everyItem.getVendorDestination());
    }
 else {
      if (!vendorDestination.contains(everyItem.getVendorDestination())) {
        vendorDestination.add(everyItem.getVendorDestination());
      }
    }
  }
  if (orderEntity.getServiceType().equals("String_Node_Str") || orderEntity.getServiceType().equals("String_Node_Str")) {
    if (orderEntity.getServiceMode().equals("String_Node_Str") || orderEntity.getServiceMode().equals("String_Node_Str") || orderEntity.getServiceMode().equals("String_Node_Str")|| orderEntity.getServiceMode().equals("String_Node_Str")|| orderEntity.getServiceMode().equals("String_Node_Str")) {
      List<Documents> waybillOrigin=documentsService.findDocumentNameAndId("String_Node_Str",orderIdParam);
      for (      String itemVendor : vendorOrigin) {
        if (itemVendor != null) {
          if (waybillOrigin.size() == 0) {
            Documents documentEntity=new Documents();
            Client client=clientService.findClientById(getClientId().toString());
            documentEntity.setClient(client);
            documentEntity.setDocumentName(DocumentsConstants.HOUSE_WAYBILL_ORIGIN);
            documentEntity.setReferenceId(orderEntity.getOrderId());
            documentEntity.setReferenceTable("String_Node_Str");
            documentEntity.setOrderNumber(orderEntity.getOrderNumber());
            documentEntity.setCreatedDate(new Date());
            documentEntity.setDocumentStatus("String_Node_Str");
            documentEntity.setVendorCode(itemVendor);
            documentEntity.setOutboundStage(1);
            documentEntity.setDocumentProcessed(0);
            documentEntity.setCreatedBy(commonUtils.getUserNameFromSession());
            String documentCode=documentsService.findNextControlNo(getClientId(),"String_Node_Str");
            documentEntity.setControlNumber(documentCode);
            documentEntity.setReferenceNumber(documentCode.replace("String_Node_Str","String_Node_Str"));
            documentsService.addDocuments(documentEntity);
          }
 else {
            clearErrorsAndMessages();
            addActionError("String_Node_Str");
          }
        }
 else {
          clearErrorsAndMessages();
          addActionError("String_Node_Str");
          for (          OrderItems orderItemsElem : orderItemsList) {
            orderItems.add(transformToOrderItemFormBean(orderItemsElem));
          }
          return INPUT;
        }
      }
    }
    if (orderEntity.getServiceMode().equals("String_Node_Str") || orderEntity.getServiceMode().equals("String_Node_Str")) {
      List<Documents> waybillDestination=documentsService.findDocumentNameAndId("String_Node_Str",orderIdParam);
      for (      String itemVendor : vendorDestination) {
        if (itemVendor != null) {
          if (waybillDestination.size() == 0) {
            Documents documentEntity=new Documents();
            Client client=clientService.findClientById(getClientId().toString());
            documentEntity.setClient(client);
            documentEntity.setDocumentName(DocumentsConstants.HOUSE_WAYBILL_DESTINATION);
            documentEntity.setReferenceId(orderEntity.getOrderId());
            documentEntity.setReferenceTable("String_Node_Str");
            documentEntity.setOrderNumber(orderEntity.getOrderNumber());
            documentEntity.setCreatedDate(new Date());
            documentEntity.setDocumentStatus("String_Node_Str");
            documentEntity.setVendorCode(itemVendor);
            documentEntity.setFinalOutboundStage(1);
            documentEntity.setDocumentProcessed(2);
            documentEntity.setCreatedBy(commonUtils.getUserNameFromSession());
            String documentCode=documentsService.findNextControlNo(getClientId(),"String_Node_Str");
            documentEntity.setControlNumber(documentCode);
            documentEntity.setReferenceNumber(documentCode.replace("String_Node_Str","String_Node_Str"));
            documentsService.addDocuments(documentEntity);
          }
 else {
            clearErrorsAndMessages();
            addActionError("String_Node_Str");
          }
        }
 else {
          clearErrorsAndMessages();
          addActionError("String_Node_Str");
          for (          OrderItems orderItemsElem : orderItemsList) {
            orderItems.add(transformToOrderItemFormBean(orderItemsElem));
          }
          return INPUT;
        }
      }
    }
  }
  clearErrorsAndMessages();
  addActionMessage("String_Node_Str");
  for (  OrderItems orderItemsElem : orderItemsList) {
    orderItems.add(transformToOrderItemFormBean(orderItemsElem));
  }
  return SUCCESS;
}

Fixed version (ground truth):
public String createdInlandDocument(){
  List<Documents> freightDocuments=documentsService.findDocumentsByOrderId(orderIdParam);
  for (  Documents freightDocumentElem : freightDocuments) {
    if (freightDocumentElem.getDocumentName().equals("String_Node_Str") || freightDocumentElem.getDocumentName().equals("String_Node_Str")) {
      Documents documentEntity=documentsService.findDocumentById(freightDocumentElem.getDocumentId());
      documentsService.deleteDocument(documentEntity);
    }
  }
  List<String> vendorOrigin=new ArrayList<String>();
  List<String> vendorDestination=new ArrayList<String>();
  List<OrderItems> orderItemsList=new ArrayList<OrderItems>();
  Orders orderEntity=orderService.findOrdersById(orderIdParam);
  order=transformToOrderFormBean(orderEntity);
  orderItemsList=operationsService.findAllOrderItemsByOrderId(orderIdParam);
  for (  OrderItems everyItem : orderItemsList) {
    if (vendorOrigin.isEmpty()) {
      vendorOrigin.add(everyItem.getVendorOrigin());
    }
 else {
      if (!vendorOrigin.contains(everyItem.getVendorOrigin())) {
        vendorOrigin.add(everyItem.getVendorOrigin());
      }
    }
  }
  for (  OrderItems everyItem : orderItemsList) {
    if (vendorDestination.isEmpty()) {
      vendorDestination.add(everyItem.getVendorDestination());
    }
 else {
      if (!vendorDestination.contains(everyItem.getVendorDestination())) {
        vendorDestination.add(everyItem.getVendorDestination());
      }
    }
  }
  if (orderEntity.getServiceType().equals("String_Node_Str") || orderEntity.getServiceType().equals("String_Node_Str")) {
    if (orderEntity.getServiceMode().equals("String_Node_Str") || orderEntity.getServiceMode().equals("String_Node_Str") || orderEntity.getServiceMode().equals("String_Node_Str")|| orderEntity.getServiceMode().equals("String_Node_Str")) {
      List<Documents> waybillOrigin=documentsService.findDocumentNameAndId("String_Node_Str",orderIdParam);
      for (      String itemVendor : vendorOrigin) {
        if (itemVendor != null) {
          if (waybillOrigin.size() == 0) {
            Documents documentEntity=new Documents();
            Client client=clientService.findClientById(getClientId().toString());
            documentEntity.setClient(client);
            documentEntity.setDocumentName(DocumentsConstants.HOUSE_WAYBILL_ORIGIN);
            documentEntity.setReferenceId(orderEntity.getOrderId());
            documentEntity.setReferenceTable("String_Node_Str");
            documentEntity.setOrderNumber(orderEntity.getOrderNumber());
            documentEntity.setCreatedDate(new Date());
            documentEntity.setDocumentStatus("String_Node_Str");
            documentEntity.setVendorCode(itemVendor);
            documentEntity.setOutboundStage(1);
            documentEntity.setDocumentProcessed(0);
            documentEntity.setCreatedBy(commonUtils.getUserNameFromSession());
            String documentCode=documentsService.findNextControlNo(getClientId(),"String_Node_Str");
            documentEntity.setControlNumber(documentCode);
            documentsService.addDocuments(documentEntity);
          }
 else {
            clearErrorsAndMessages();
            addActionError("String_Node_Str");
          }
        }
 else {
          clearErrorsAndMessages();
          addActionError("String_Node_Str");
          for (          OrderItems orderItemsElem : orderItemsList) {
            orderItems.add(transformToOrderItemFormBean(orderItemsElem));
          }
          return INPUT;
        }
      }
    }
    if (orderEntity.getServiceMode().equals("String_Node_Str") || orderEntity.getServiceMode().equals("String_Node_Str") || orderEntity.getServiceMode().equals("String_Node_Str")) {
      List<Documents> waybillDestination=documentsService.findDocumentNameAndId("String_Node_Str",orderIdParam);
      for (      String itemVendor : vendorDestination) {
        if (itemVendor != null) {
          if (waybillDestination.size() == 0) {
            Documents documentEntity=new Documents();
            Client client=clientService.findClientById(getClientId().toString());
            documentEntity.setClient(client);
            documentEntity.setDocumentName(DocumentsConstants.HOUSE_WAYBILL_DESTINATION);
            documentEntity.setReferenceId(orderEntity.getOrderId());
            documentEntity.setReferenceTable("String_Node_Str");
            documentEntity.setOrderNumber(orderEntity.getOrderNumber());
            documentEntity.setCreatedDate(new Date());
            documentEntity.setDocumentStatus("String_Node_Str");
            documentEntity.setVendorCode(itemVendor);
            if (orderEntity.getServiceMode().equals("String_Node_Str")) {
              documentEntity.setOutboundStage(1);
              documentEntity.setDocumentProcessed(0);
            }
 else {
              documentEntity.setFinalOutboundStage(1);
              documentEntity.setDocumentProcessed(2);
            }
            documentEntity.setCreatedBy(commonUtils.getUserNameFromSession());
            String documentCode=documentsService.findNextControlNo(getClientId(),"String_Node_Str");
            documentEntity.setControlNumber(documentCode);
            documentsService.addDocuments(documentEntity);
          }
 else {
            clearErrorsAndMessages();
            addActionError("String_Node_Str");
          }
        }
 else {
          clearErrorsAndMessages();
          addActionError("String_Node_Str");
          for (          OrderItems orderItemsElem : orderItemsList) {
            orderItems.add(transformToOrderItemFormBean(orderItemsElem));
          }
          return INPUT;
        }
      }
    }
  }
  clearErrorsAndMessages();
  addActionMessage("String_Node_Str");
  for (  OrderItems orderItemsElem : orderItemsList) {
    orderItems.add(transformToOrderItemFormBean(orderItemsElem));
  }
  return SUCCESS;
}