Program: 144465
Project: 144465
Buggy source:
public String createdDocumentsSea(){
  List<Documents> documentsList=new ArrayList<Documents>();
  List<String> vendorCodeDocument=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 (vendorCodeDocument.isEmpty()) {
      vendorCodeDocument.add(everyItem.getVendorSea());
    }
 else {
      if (!vendorCodeDocument.contains(everyItem.getVendorSea())) {
        vendorCodeDocument.add(everyItem.getVendorSea());
      }
    }
  }
  List<Documents> proforma=documentsService.findDocumentNameAndId("String_Node_Str",orderIdParam);
  for (  String itemVendor : vendorCodeDocument) {
    if (proforma.size() == 0) {
      Documents documentEntity=new Documents();
      Client client=clientService.findClientById(getClientId().toString());
      documentEntity.setClient(client);
      documentEntity.setDocumentName(DocumentsConstants.PROFORMA_BILL_OF_LADING);
      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);
      documentsService.addDocuments(documentEntity);
    }
 else {
      clearErrorsAndMessages();
      addActionMessage("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 createdDocumentsSea(){
  List<Documents> documentsList=new ArrayList<Documents>();
  List<String> vendorCodeDocument=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 (vendorCodeDocument.isEmpty()) {
      vendorCodeDocument.add(everyItem.getVendorSea());
    }
 else {
      if (!vendorCodeDocument.contains(everyItem.getVendorSea())) {
        vendorCodeDocument.add(everyItem.getVendorSea());
      }
    }
  }
  List<Documents> proforma=documentsService.findDocumentNameAndId("String_Node_Str",orderIdParam);
  List<Documents> houseWayBill=documentsService.findDocumentNameAndId("String_Node_Str",orderIdParam);
  for (  String itemVendor : vendorCodeDocument) {
    if (proforma.size() == 0) {
      Documents documentEntityProforma=new Documents();
      Client client=clientService.findClientById(getClientId().toString());
      documentEntityProforma.setClient(client);
      documentEntityProforma.setDocumentName(DocumentsConstants.PROFORMA_BILL_OF_LADING);
      documentEntityProforma.setReferenceId(orderEntity.getOrderId());
      documentEntityProforma.setReferenceTable("String_Node_Str");
      documentEntityProforma.setOrderNumber(orderEntity.getOrderNumber());
      documentEntityProforma.setCreatedDate(new Date());
      documentEntityProforma.setDocumentStatus("String_Node_Str");
      documentEntityProforma.setVendorCode(itemVendor);
      documentEntityProforma.setOutboundStage(1);
      documentEntityProforma.setDocumentProcessed(0);
      documentsService.addDocuments(documentEntityProforma);
    }
 else {
      clearErrorsAndMessages();
      addActionMessage("String_Node_Str");
      for (      OrderItems orderItemsElem : orderItemsList) {
        orderItems.add(transformToOrderItemFormBean(orderItemsElem));
      }
      return INPUT;
    }
  }
  if (houseWayBill.size() == 0) {
    Documents documentEntityHouse=new Documents();
    Client client=clientService.findClientById(getClientId().toString());
    documentEntityHouse.setClient(client);
    documentEntityHouse.setDocumentName(DocumentsConstants.HOUSE_BILL_OF_LADING);
    documentEntityHouse.setReferenceId(orderEntity.getOrderId());
    documentEntityHouse.setReferenceTable("String_Node_Str");
    documentEntityHouse.setOrderNumber(orderEntity.getOrderNumber());
    documentEntityHouse.setCreatedDate(new Date());
    documentEntityHouse.setDocumentStatus("String_Node_Str");
    documentEntityHouse.setVendorCode("String_Node_Str");
    documentEntityHouse.setOutboundStage(1);
    documentEntityHouse.setDocumentProcessed(0);
    documentsService.addDocuments(documentEntityHouse);
  }
 else {
    clearErrorsAndMessages();
    addActionMessage("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;
}