Program: 144471
Project: 144471
Buggy source:
public String createdDocumentOrigin(){
  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.getVendorOrigin());
    }
 else {
      if (!vendorCodeDocument.contains(everyItem.getVendorOrigin())) {
        vendorCodeDocument.add(everyItem.getVendorOrigin());
      }
    }
  }
  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.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.setReferenceNumber(orderIdParam.toString());
      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 createdDocumentOrigin(){
  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.getVendorOrigin());
    }
 else {
      if (!vendorCodeDocument.contains(everyItem.getVendorOrigin())) {
        vendorCodeDocument.add(everyItem.getVendorOrigin());
      }
    }
  }
  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.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.setReferenceNumber(orderIdParam.toString());
      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;
}