nus-yam/ex-repair huggingface dataset:
Program: 58904
Project: 58904
Buggy source:
public List<InvoiceLine> createInvoiceLine(Invoice invoice,ProjectTask projectTask) throws AxelorException {
  Product product=projectTask.getProduct();
  if (product == null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.INVOICING_FOLDER_PROJECT_TASK_PRODUCT),projectTask.getFullName()),IException.CONFIGURATION_ERROR);
  }
  InvoiceLineGenerator invoiceLineGenerator=new InvoiceLineGenerator(invoice,product,product.getName(),projectTask.getPrice(),null,projectTask.getQty(),projectTask.getUnit(),InvoiceLineGenerator.DEFAULT_SEQUENCE,BigDecimal.ZERO,IPriceListLine.AMOUNT_TYPE_NONE,projectTask.getPrice().multiply(projectTask.getQty()),null,false){
    @Override public List<InvoiceLine> creates() throws AxelorException {
      InvoiceLine invoiceLine=this.createInvoiceLine();
      List<InvoiceLine> invoiceLines=new ArrayList<InvoiceLine>();
      invoiceLines.add(invoiceLine);
      return invoiceLines;
    }
  }
;
  return invoiceLineGenerator.creates();
}

Fixed version (ground truth):
public List<InvoiceLine> createInvoiceLine(Invoice invoice,ProjectTask projectTask) throws AxelorException {
  Product product=projectTask.getProduct();
  if (product == null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.INVOICING_FOLDER_PROJECT_TASK_PRODUCT),projectTask.getFullName()),IException.CONFIGURATION_ERROR);
  }
  InvoiceLineGenerator invoiceLineGenerator=new InvoiceLineGenerator(invoice,product,projectTask.getName(),projectTask.getPrice(),null,projectTask.getQty(),projectTask.getUnit(),InvoiceLineGenerator.DEFAULT_SEQUENCE,BigDecimal.ZERO,IPriceListLine.AMOUNT_TYPE_NONE,projectTask.getPrice().multiply(projectTask.getQty()),null,false){
    @Override public List<InvoiceLine> creates() throws AxelorException {
      InvoiceLine invoiceLine=this.createInvoiceLine();
      List<InvoiceLine> invoiceLines=new ArrayList<InvoiceLine>();
      invoiceLines.add(invoiceLine);
      return invoiceLines;
    }
  }
;
  return invoiceLineGenerator.creates();
}
Program: 58906
Project: 58906
Buggy source:
@Transactional public List<Long> generateTasks(SaleOrder saleOrder){
  List<Long> listId=new ArrayList<Long>();
  List<SaleOrderLine> saleOrderLineList=saleOrder.getSaleOrderLineList();
  for (  SaleOrderLine saleOrderLine : saleOrderLineList) {
    Product product=saleOrderLine.getProduct();
    if (product.getProductTypeSelect() == ProductRepository.PRODUCT_TYPE_SERVICE && product.getProcurementMethodSelect() == ProductRepository.PROCUREMENT_METHOD_PRODUCE) {
      ProjectTask task=new ProjectTask();
      task.setStatusSelect(ProjectTaskRepository.STATE_PLANNED);
      task.setProject(saleOrder.getProject());
      task.setName(saleOrderLine.getFullName());
      task.setAssignedTo(saleOrder.getSalemanUser());
      task.setProgress(0);
      task.setImputable(true);
      task.setProduct(GeneralService.getGeneral().getProductInvoicingProjectTask());
      saleOrderLine.setProject(task);
      JPA.save(saleOrderLine);
      listId.add(task.getId());
    }
  }
  return listId;
}

Fixed version (ground truth):
@Transactional public List<Long> generateTasks(SaleOrder saleOrder){
  List<Long> listId=new ArrayList<Long>();
  List<SaleOrderLine> saleOrderLineList=saleOrder.getSaleOrderLineList();
  for (  SaleOrderLine saleOrderLine : saleOrderLineList) {
    Product product=saleOrderLine.getProduct();
    if (product.getProductTypeSelect() == ProductRepository.PRODUCT_TYPE_SERVICE && product.getProcurementMethodSelect() == ProductRepository.PROCUREMENT_METHOD_PRODUCE) {
      ProjectTask task=new ProjectTask();
      task.setTaskTypeSelect(ProjectTaskRepository.TYPE_TASK);
      task.setStatusSelect(ProjectTaskRepository.STATE_PLANNED);
      task.setProject(saleOrder.getProject());
      task.setName(saleOrderLine.getFullName());
      task.setAssignedTo(saleOrder.getSalemanUser());
      task.setProgress(0);
      task.setImputable(true);
      task.setProduct(GeneralService.getGeneral().getProductInvoicingProjectTask());
      saleOrderLine.setProject(task);
      JPA.save(saleOrderLine);
      listId.add(task.getId());
    }
  }
  return listId;
}
Program: 58907
Project: 58907
Buggy source:
@Transactional public ProjectTask generateProject(SaleOrder saleOrder){
  ProjectTask project=new ProjectTask();
  project.setStatusSelect(ProjectTaskRepository.STATE_PLANNED);
  project.setName(saleOrder.getFullName());
  project.setCompany(saleOrder.getCompany());
  project.setClientPartner(saleOrder.getClientPartner());
  project.setAssignedTo(saleOrder.getSalemanUser());
  project.setSaleOrder(saleOrder);
  project.setProgress(0);
  project.setImputable(true);
  project.setInvoicingTypeSelect(ProjectTaskRepository.INVOICING_TYPE_NONE);
  project.addMembersUserSetItem(saleOrder.getSalemanUser());
  project.setProduct(GeneralService.getGeneral().getProductInvoicingProjectTask());
  saleOrder.setProject(project);
  save(saleOrder);
  return project;
}

Fixed version (ground truth):
@Transactional public ProjectTask generateProject(SaleOrder saleOrder){
  ProjectTask project=new ProjectTask();
  project.setTaskTypeSelect(ProjectTaskRepository.TYPE_PROJECT);
  project.setStatusSelect(ProjectTaskRepository.STATE_PLANNED);
  project.setName(saleOrder.getFullName());
  project.setCompany(saleOrder.getCompany());
  project.setClientPartner(saleOrder.getClientPartner());
  project.setAssignedTo(saleOrder.getSalemanUser());
  project.setSaleOrder(saleOrder);
  project.setProgress(0);
  project.setImputable(true);
  project.setInvoicingTypeSelect(ProjectTaskRepository.INVOICING_TYPE_NONE);
  project.addMembersUserSetItem(saleOrder.getSalemanUser());
  project.setProduct(GeneralService.getGeneral().getProductInvoicingProjectTask());
  saleOrder.setProject(project);
  save(saleOrder);
  return project;
}
Program: 58908
Project: 58908
Buggy source:
public void generateTasks(ActionRequest request,ActionResponse response) throws AxelorException {
  SaleOrder saleOrder=request.getContext().asType(SaleOrder.class);
  saleOrder=this.find(saleOrder.getId());
  if (saleOrder.getProject() == null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.SALE_ORDER_NO_PROJECT)),IException.CONFIGURATION_ERROR);
  }
  List<Long> listId=saleOrderProjectService.generateTasks(saleOrder);
  response.setReload(true);
  response.setView(ActionView.define("String_Node_Str").model(ProjectTask.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").param("String_Node_Str","String_Node_Str").domain("String_Node_Str" + listId + "String_Node_Str").map());
}

Fixed version (ground truth):
public void generateTasks(ActionRequest request,ActionResponse response) throws AxelorException {
  SaleOrder saleOrder=request.getContext().asType(SaleOrder.class);
  saleOrder=this.find(saleOrder.getId());
  if (saleOrder.getProject() == null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.SALE_ORDER_NO_PROJECT)),IException.CONFIGURATION_ERROR);
  }
  List<Long> listId=saleOrderProjectService.generateTasks(saleOrder);
  if (listId == null || listId.isEmpty()) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.SALE_ORDER_NO_LINES)),IException.CONFIGURATION_ERROR);
  }
  response.setReload(true);
  response.setView(ActionView.define("String_Node_Str").model(ProjectTask.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").param("String_Node_Str","String_Node_Str").domain("String_Node_Str" + listId + "String_Node_Str").map());
}
Program: 58911
Project: 58911
Buggy source:
public List<InvoiceLine> customerChargeBackPurchases(List<InvoiceLine> invoiceLineList,InvoicingFolder folder){
  Partner customer=folder.getProjectTask().getClientPartner();
  if (!customer.getFlatFeeExpense()) {
    for (    InvoiceLine invoiceLine : invoiceLineList) {
      invoiceLine.setPrice(invoiceLine.getPrice().multiply(customer.getChargeBackPurchase().divide(new BigDecimal(100),GeneralService.getNbDecimalDigitForUnitPrice(),BigDecimal.ROUND_HALF_UP)));
      invoiceLine.setExTaxTotal(invoiceLine.getPrice().multiply(invoiceLine.getQty()).setScale(2,BigDecimal.ROUND_HALF_UP));
    }
  }
  return invoiceLineList;
}

Fixed version (ground truth):
public List<InvoiceLine> customerChargeBackPurchases(List<InvoiceLine> invoiceLineList,InvoicingFolder folder){
  Partner customer=folder.getProjectTask().getClientPartner();
  if (!customer.getFlatFeePurchase()) {
    for (    InvoiceLine invoiceLine : invoiceLineList) {
      invoiceLine.setPrice(invoiceLine.getPrice().multiply(customer.getChargeBackPurchase().divide(new BigDecimal(100),GeneralService.getNbDecimalDigitForUnitPrice(),BigDecimal.ROUND_HALF_UP)));
      invoiceLine.setExTaxTotal(invoiceLine.getPrice().multiply(invoiceLine.getQty()).setScale(2,BigDecimal.ROUND_HALF_UP));
    }
  }
  return invoiceLineList;
}
Program: 58912
Project: 58912
Buggy source:
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public Target createTarget(TargetConfiguration targetConfiguration,LocalDate fromDate,LocalDate toDate){
  Target target=new Target();
  target.setCallEmittedNumberTarget(targetConfiguration.getCallEmittedNumber());
  target.setMeetingNumberTarget(targetConfiguration.getMeetingNumber());
  target.setOpportunityAmountWonTarget(targetConfiguration.getOpportunityAmountWon());
  target.setOpportunityCreatedNumberTarget(target.getOpportunityCreatedNumberTarget());
  target.setOpportunityCreatedWonTarget(target.getOpportunityCreatedWonTarget());
  target.setPeriodTypeSelect(targetConfiguration.getPeriodTypeSelect());
  target.setFromDate(fromDate);
  target.setToDate(toDate);
  target.setUser(targetConfiguration.getUser());
  target.setTeam(targetConfiguration.getTeam());
  target.setName(targetConfiguration.getName());
  target.setCode(targetConfiguration.getCode());
  return save(target);
}

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public Target createTarget(TargetConfiguration targetConfiguration,LocalDate fromDate,LocalDate toDate){
  Target target=new Target();
  target.setCallEmittedNumberTarget(targetConfiguration.getCallEmittedNumber());
  target.setMeetingNumberTarget(targetConfiguration.getMeetingNumber());
  target.setOpportunityAmountWonTarget(targetConfiguration.getOpportunityAmountWon());
  target.setOpportunityCreatedNumberTarget(targetConfiguration.getOpportunityCreatedNumber());
  target.setOpportunityCreatedWonTarget(targetConfiguration.getOpportunityCreatedWon());
  target.setPeriodTypeSelect(targetConfiguration.getPeriodTypeSelect());
  target.setFromDate(fromDate);
  target.setToDate(toDate);
  target.setUser(targetConfiguration.getUser());
  target.setTeam(targetConfiguration.getTeam());
  target.setName(targetConfiguration.getName());
  target.setCode(targetConfiguration.getCode());
  return save(target);
}
Program: 58913
Project: 58913
Buggy source:
@Override protected void process(){
  int i=0;
  List<TargetConfiguration> targetConfigurationList=new ArrayList<TargetConfiguration>();
  if (batch.getCrmBatch().getTargetConfigurationSet() != null && !batch.getCrmBatch().getTargetConfigurationSet().isEmpty()) {
    targetConfigurationList.addAll(batch.getCrmBatch().getTargetConfigurationSet());
  }
  for (  TargetConfiguration targetConfiguration : targetConfigurationList) {
    try {
      targetService.createsTargets(targetConfiguration);
      i++;
    }
 catch (    Exception e) {
      TraceBackService.trace(new Exception(String.format(I18n.get(IExceptionMessage.BATCH_TARGET_1),targetConfigurationRepo.find(targetConfiguration.getId()).getCode()),e),IException.CRM,batch.getId());
      incrementAnomaly();
      LOG.error("String_Node_Str",targetConfigurationRepo.find(targetConfiguration.getId()).getCode());
    }
 finally {
      if (i % 1 == 0) {
        JPA.clear();
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void process(){
  int i=0;
  List<TargetConfiguration> targetConfigurationList=new ArrayList<TargetConfiguration>();
  if (batch.getCrmBatch().getTargetConfigurationSet() != null && !batch.getCrmBatch().getTargetConfigurationSet().isEmpty()) {
    targetConfigurationList.addAll(batch.getCrmBatch().getTargetConfigurationSet());
  }
  for (  TargetConfiguration targetConfiguration : targetConfigurationList) {
    try {
      targetService.createsTargets(targetConfiguration);
      updateTargetConfiguration(targetConfiguration);
      i++;
    }
 catch (    Exception e) {
      TraceBackService.trace(new Exception(String.format(I18n.get(IExceptionMessage.BATCH_TARGET_1),targetConfigurationRepo.find(targetConfiguration.getId()).getCode()),e),IException.CRM,batch.getId());
      incrementAnomaly();
      LOG.error("String_Node_Str",targetConfigurationRepo.find(targetConfiguration.getId()).getCode());
    }
 finally {
      if (i % 1 == 0) {
        JPA.clear();
      }
    }
  }
}
Program: 58914
Project: 58914
Buggy source:
/** 
 * Détermine le numéro de facture
 * @param invoice
 * @param company
 * @throws AxelorException
 */
protected void setInvoiceId(Sequence sequence) throws AxelorException {
  if (!Strings.isNullOrEmpty(invoice.getInvoiceId())) {
    return;
  }
  invoice.setInvoiceId(sequenceService.setRefDate(invoice.getInvoiceDate()).getSequenceNumber(sequence));
  if (invoice.getInvoiceId() != null) {
    return;
  }
  throw new AxelorException(String.format(I18n.get(IExceptionMessage.VENTILATE_STATE_4),invoice.getCompany().getName()),IException.CONFIGURATION_ERROR);
}

Fixed version (ground truth):
/** 
 * Détermine le numéro de facture
 * @param invoice
 * @param company
 * @throws AxelorException
 */
protected void setInvoiceId(Sequence sequence) throws AxelorException {
  if (!Strings.isNullOrEmpty(invoice.getInvoiceId()) && !invoice.getInvoiceId().contains("String_Node_Str")) {
    return;
  }
  invoice.setInvoiceId(sequenceService.setRefDate(invoice.getInvoiceDate()).getSequenceNumber(sequence));
  if (invoice.getInvoiceId() != null) {
    return;
  }
  throw new AxelorException(String.format(I18n.get(IExceptionMessage.VENTILATE_STATE_4),invoice.getCompany().getName()),IException.CONFIGURATION_ERROR);
}
Program: 58917
Project: 58917
Buggy source:
public SaleOrder createSaleOrderFromTemplate(BusinessFolder businessFolder) throws AxelorException {
  SaleOrder saleOrder=saleOrderService.createSaleOrder(businessFolder.getTemplate());
  if (businessFolder.getCustomer() != null) {
    saleOrder.setClientPartner(businessFolder.getCustomer());
    saleOrder=saleOrderService.getClientInformations(saleOrder);
  }
  return saleOrder;
}

Fixed version (ground truth):
public SaleOrder createSaleOrderFromTemplate(BusinessFolder businessFolder) throws AxelorException {
  SaleOrder saleOrder=saleOrderService.createSaleOrder(businessFolder.getTemplateSaleOrder());
  if (businessFolder.getCustomer() != null) {
    saleOrder.setClientPartner(businessFolder.getCustomer());
    saleOrder=saleOrderService.getClientInformations(saleOrder);
  }
  return saleOrder;
}
Program: 58918
Project: 58918
Buggy source:
public void createSaleOrder(ActionRequest request,ActionResponse response) throws AxelorException {
  BusinessFolder businessFolder=this.find(Long.parseLong(request.getContext().get("String_Node_Str").toString()));
  SaleOrder saleOrder=null;
  if (businessFolder.getTemplate() == null) {
    saleOrder=businessFolderService.createSaleOrder(businessFolder);
  }
 else {
    saleOrder=businessFolderService.createSaleOrderFromTemplate(businessFolder);
  }
  response.setValues(saleOrder);
}

Fixed version (ground truth):
public void createSaleOrder(ActionRequest request,ActionResponse response) throws AxelorException {
  BusinessFolder businessFolder=this.find(Long.parseLong(request.getContext().get("String_Node_Str").toString()));
  SaleOrder saleOrder=null;
  if (businessFolder.getTemplateSaleOrder() == null) {
    saleOrder=businessFolderService.createSaleOrder(businessFolder);
  }
 else {
    saleOrder=businessFolderService.createSaleOrderFromTemplate(businessFolder);
  }
  response.setValues(saleOrder);
}
Program: 58919
Project: 58919
Buggy source:
@Override @Transactional(rollbackOn={AxelorException.class,Exception.class}) public ProductionOrder generateProductionOrder(SaleOrderLine saleOrderLine) throws AxelorException {
  Product product=saleOrderLine.getProduct();
  if (saleOrderLine.getSaleSupplySelect() == IProduct.SALE_SUPPLY_PRODUCE && product != null && product.getProductTypeSelect().equals(IProduct.PRODUCT_TYPE_STORABLE)) {
    BillOfMaterial billOfMaterial=saleOrderLine.getBillOfMaterial();
    if (billOfMaterial == null) {
      billOfMaterial=product.getDefaultBillOfMaterial();
    }
    if (billOfMaterial == null && product.getParentProduct() != null) {
      billOfMaterial=product.getParentProduct().getDefaultBillOfMaterial();
    }
    if (billOfMaterial == null) {
      throw new AxelorException(String.format(I18n.get(IExceptionMessage.PRODUCTION_ORDER_SALES_ORDER_NO_BOM),product.getName(),product.getCode()),IException.CONFIGURATION_ERROR);
    }
    return save(productionOrderService.generateProductionOrder(product,billOfMaterial,saleOrderLine.getQty()));
  }
  return null;
}

Fixed version (ground truth):
@Override @Transactional(rollbackOn={AxelorException.class,Exception.class}) public ProductionOrder generateProductionOrder(SaleOrderLine saleOrderLine) throws AxelorException {
  Product product=saleOrderLine.getProduct();
  if (saleOrderLine.getSaleSupplySelect() == ProductRepository.SALE_SUPPLY_PRODUCE && product != null && product.getProductTypeSelect().equals(ProductRepository.PRODUCT_TYPE_STORABLE)) {
    BillOfMaterial billOfMaterial=saleOrderLine.getBillOfMaterial();
    if (billOfMaterial == null) {
      billOfMaterial=product.getDefaultBillOfMaterial();
    }
    if (billOfMaterial == null && product.getParentProduct() != null) {
      billOfMaterial=product.getParentProduct().getDefaultBillOfMaterial();
    }
    if (billOfMaterial == null) {
      throw new AxelorException(String.format(I18n.get(IExceptionMessage.PRODUCTION_ORDER_SALES_ORDER_NO_BOM),product.getName(),product.getCode()),IException.CONFIGURATION_ERROR);
    }
    return save(productionOrderService.generateProductionOrder(product,billOfMaterial,saleOrderLine.getQty()));
  }
  return null;
}
Program: 58920
Project: 58920
Buggy source:
public Invoice createInvoice(SaleOrder saleOrder) throws AxelorException ;

Fixed version (ground truth):
public Invoice createInvoice(SaleOrder saleOrder,List<SaleOrderLine> saleOrderLineList) throws AxelorException ;
Program: 58921
Project: 58921
Buggy source:
@Override public Invoice createInvoice(SaleOrder saleOrder) throws AxelorException {
  InvoiceGenerator invoiceGenerator=this.createInvoiceGenerator(saleOrder);
  Invoice invoice=invoiceGenerator.generate();
  invoice.setInAti(Beans.get(AccountConfigRepository.class).all().filter("String_Node_Str",saleOrder.getCompany()).fetchOne().getInvoiceInAti());
  invoiceGenerator.populate(invoice,this.createInvoiceLines(invoice,saleOrder.getSaleOrderLineList()));
  return invoice;
}

Fixed version (ground truth):
@Override public Invoice createInvoice(SaleOrder saleOrder,List<SaleOrderLine> saleOrderLineList) throws AxelorException {
  InvoiceGenerator invoiceGenerator=this.createInvoiceGenerator(saleOrder);
  Invoice invoice=invoiceGenerator.generate();
  invoice.setInAti(Beans.get(AccountConfigRepository.class).all().filter("String_Node_Str",saleOrder.getCompany()).fetchOne().getInvoiceInAti());
  invoiceGenerator.populate(invoice,this.createInvoiceLines(invoice,saleOrderLineList));
  return invoice;
}
Program: 58923
Project: 58923
Buggy source:
@Transactional(rollbackOn={Exception.class}) public Invoice generateInvoice(Subscription subscription,SaleOrderLine saleOrderLine,SaleOrder saleOrder) throws AxelorException {
  InvoiceGenerator invoiceGenerator=saleOrderInvoiceServiceImpl.createInvoiceGenerator(saleOrder);
  Invoice invoice=invoiceGenerator.generate();
  invoice.setInvoiceLineList(saleOrderInvoiceServiceImpl.createInvoiceLine(invoice,saleOrderLine));
  saleOrderInvoiceServiceImpl.assignInvoice(saleOrder,invoice);
  invoice.setIsSubscription(true);
  invoice.setSubscriptionFromDate(subscription.getFromPeriodDate());
  invoice.setSubscriptionToDate(subscription.getToPeriodDate());
  for (  InvoiceLine invoiceLine : invoice.getInvoiceLineList()) {
    invoiceLine.setProductName(invoiceLine.getProduct().getName() + "String_Node_Str" + saleOrderLine.getPeriodicity()+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  }
  Beans.get(InvoiceServiceImpl.class).save(invoice);
  subscription.setInvoiced(true);
  save(subscription);
  return invoice;
}

Fixed version (ground truth):
@Override @Transactional(rollbackOn={Exception.class}) public Invoice generateInvoice(Subscription subscription,SaleOrderLine saleOrderLine,SaleOrder saleOrder) throws AxelorException {
  InvoiceGenerator invoiceGenerator=saleOrderInvoiceServiceImpl.createInvoiceGenerator(saleOrder);
  List<SaleOrderLine> saleOrderLineList=new ArrayList<SaleOrderLine>();
  saleOrderLineList.add(saleOrderLine);
  Invoice invoice=saleOrderInvoiceServiceImpl.createInvoice(saleOrder,saleOrderLineList);
  saleOrderInvoiceServiceImpl.assignInvoice(saleOrder,invoice);
  invoice.setIsSubscription(true);
  invoice.setSubscriptionFromDate(subscription.getFromPeriodDate());
  invoice.setSubscriptionToDate(subscription.getToPeriodDate());
  for (  InvoiceLine invoiceLine : invoice.getInvoiceLineList()) {
    invoiceLine.setProductName(invoiceLine.getProduct().getName() + "String_Node_Str" + saleOrderLine.getPeriodicity()+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  }
  Beans.get(InvoiceServiceImpl.class).save(invoice);
  subscription.setInvoiced(true);
  save(subscription);
  return invoice;
}
Program: 58924
Project: 58924
Buggy source:
public BigDecimal getPlanningLinesAmount(Task task,LocalDate startDate) throws AxelorException {
  BigDecimal planningLinesAmount=BigDecimal.ZERO;
  if (task.getPlanningLineList() == null)   return planningLinesAmount;
  for (  PlanningLine planningLine : task.getPlanningLineList()) {
    if (startDate == null || planningLine.getFromDateTime().isAfter(startDate)) {
      Employee employee=planningLine.getEmployee();
      Product profil=planningLine.getProduct();
      if (employee != null) {
        planningLinesAmount=planningLinesAmount.add(employee.getDailySalaryCost().multiply(unitConversionService.convert(planningLine.getUnit(),unitRepo.findByCode("String_Node_Str"),planningLine.getDuration())));
      }
 else       if (profil != null) {
        planningLinesAmount=planningLinesAmount.add(profil.getCostPrice().multiply(unitConversionService.convert(planningLine.getUnit(),profil.getUnit(),planningLine.getDuration())));
      }
    }
  }
  return planningLinesAmount;
}

Fixed version (ground truth):
public BigDecimal getPlanningLinesAmount(Task task,LocalDate startDate) throws AxelorException {
  BigDecimal planningLinesAmount=BigDecimal.ZERO;
  if (task.getPlanningLineList() == null)   return planningLinesAmount;
  for (  PlanningLine planningLine : task.getPlanningLineList()) {
    if (startDate == null || planningLine.getFromDateTime().toLocalDate().isAfter(startDate)) {
      Employee employee=planningLine.getEmployee();
      Product profil=planningLine.getProduct();
      if (employee != null) {
        planningLinesAmount=planningLinesAmount.add(employee.getDailySalaryCost().multiply(unitConversionService.convert(planningLine.getUnit(),unitRepo.findByCode("String_Node_Str"),planningLine.getDuration())));
      }
 else       if (profil != null) {
        planningLinesAmount=planningLinesAmount.add(profil.getCostPrice().multiply(unitConversionService.convert(planningLine.getUnit(),profil.getUnit(),planningLine.getDuration())));
      }
    }
  }
  return planningLinesAmount;
}
Program: 58926
Project: 58926
Buggy source:
protected InvoiceLineGeneratorSupplyChain(Invoice invoice,Product product,String productName,String description,BigDecimal qty,Unit unit,InvoiceLineType invoiceLineType,int sequence,boolean isTaxInvoice,SaleOrderLine saleOrderLine,PurchaseOrderLine purchaseOrderLine,StockMove stockMove){
  super(invoice,product,productName,description,qty,unit,invoiceLineType,sequence,isTaxInvoice);
  if (saleOrderLine != null) {
    this.saleOrderLine=saleOrderLine;
    this.discountAmount=saleOrderLine.getDiscountAmount();
    this.price=saleOrderLine.getPrice();
    this.priceDiscounted=saleOrderLine.getPriceDiscounted();
    this.taxLine=saleOrderLine.getTaxLine();
    this.exTaxTotal=saleOrderLine.getExTaxTotal();
    this.inTaxTotal=saleOrderLine.getInTaxTotal();
    this.discountTypeSelect=saleOrderLine.getDiscountTypeSelect();
  }
 else   if (purchaseOrderLine != null) {
    this.purchaseOrderLine=purchaseOrderLine;
    this.discountAmount=purchaseOrderLine.getDiscountAmount();
    this.price=purchaseOrderLine.getPrice();
    this.priceDiscounted=purchaseOrderLine.getPriceDiscounted();
    this.taxLine=purchaseOrderLine.getTaxLine();
    this.exTaxTotal=purchaseOrderLine.getExTaxTotal();
    this.inTaxTotal=purchaseOrderLine.getInTaxTotal();
    this.discountTypeSelect=purchaseOrderLine.getDiscountTypeSelect();
  }
  if (stockMove != null) {
    this.stockMove=stockMove;
  }
}

Fixed version (ground truth):
protected InvoiceLineGeneratorSupplyChain(Invoice invoice,Product product,String productName,String description,BigDecimal qty,Unit unit,InvoiceLineType invoiceLineType,int sequence,boolean isTaxInvoice,SaleOrderLine saleOrderLine,PurchaseOrderLine purchaseOrderLine,StockMove stockMove){
  super(invoice,product,productName,description,qty,unit,invoiceLineType,sequence,isTaxInvoice);
  if (saleOrderLine != null) {
    this.saleOrderLine=saleOrderLine;
    this.discountAmount=saleOrderLine.getDiscountAmount();
    this.price=saleOrderLine.getPrice();
    this.priceDiscounted=saleOrderLine.getPriceDiscounted();
    this.taxLine=saleOrderLine.getTaxLine();
    this.discountTypeSelect=saleOrderLine.getDiscountTypeSelect();
  }
 else   if (purchaseOrderLine != null) {
    this.purchaseOrderLine=purchaseOrderLine;
    this.discountAmount=purchaseOrderLine.getDiscountAmount();
    this.price=purchaseOrderLine.getPrice();
    this.priceDiscounted=purchaseOrderLine.getPriceDiscounted();
    this.taxLine=purchaseOrderLine.getTaxLine();
    this.discountTypeSelect=purchaseOrderLine.getDiscountTypeSelect();
  }
  if (stockMove != null) {
    this.stockMove=stockMove;
  }
}
Program: 58927
Project: 58927
Buggy source:
public BigDecimal getDiscountAmount(PriceListLine priceListLine,BigDecimal unitPrice){
switch (priceListLine.getTypeSelect()) {
case IPriceListLine.TYPE_ADDITIONNAL:
    return priceListLine.getAmount();
case IPriceListLine.TYPE_DISCOUNT:
  return priceListLine.getAmount().negate();
case IPriceListLine.TYPE_REPLACE:
return priceListLine.getAmount().subtract(unitPrice);
default :
return BigDecimal.ZERO;
}
}

Fixed version (ground truth):
public BigDecimal getDiscountAmount(PriceListLine priceListLine,BigDecimal unitPrice){
switch (priceListLine.getTypeSelect()) {
case IPriceListLine.TYPE_ADDITIONNAL:
    return priceListLine.getAmount().negate();
case IPriceListLine.TYPE_DISCOUNT:
  return priceListLine.getAmount();
case IPriceListLine.TYPE_REPLACE:
return unitPrice.subtract(priceListLine.getAmount());
default :
return BigDecimal.ZERO;
}
}
Program: 58930
Project: 58930
Buggy source:
public BigDecimal convertDiscountAmount(InvoiceLine invoiceLine,Invoice invoice){
  BigDecimal discountAmount=this.computeDiscount(invoiceLine).subtract(invoiceLine.getProduct().getSalePrice());
  if (invoice.getOperationTypeSelect() < 2) {
    discountAmount=this.computeDiscount(invoiceLine).subtract(invoiceLine.getProduct().getPurchasePrice());
  }
  if (invoiceLine.getProduct().getInAti() && !invoice.getInAti()) {
    discountAmount=discountAmount.subtract(discountAmount.multiply(invoiceLine.getTaxLine().getValue()));
  }
 else   if (!invoiceLine.getProduct().getInAti() && invoice.getInAti()) {
    discountAmount=discountAmount.add(discountAmount.multiply(invoiceLine.getTaxLine().getValue()));
  }
  return discountAmount;
}

Fixed version (ground truth):
public BigDecimal convertDiscountAmount(InvoiceLine invoiceLine,Invoice invoice){
  BigDecimal discountAmount=BigDecimal.ZERO;
  if (invoiceLine.getDiscountTypeSelect() == IPriceListLine.AMOUNT_TYPE_FIXED) {
    discountAmount=this.computeDiscount(invoiceLine,invoice).subtract(invoiceLine.getProduct().getSalePrice());
    if (invoice.getOperationTypeSelect() < 2) {
      discountAmount=this.computeDiscount(invoiceLine,invoice).subtract(invoiceLine.getProduct().getPurchasePrice());
    }
  }
 else {
    discountAmount=(this.computeDiscount(invoiceLine,invoice).subtract((invoiceLine.getProduct().getSalePrice()))).multiply(new BigDecimal(100)).divide(invoiceLine.getProduct().getSalePrice());
    if (invoice.getOperationTypeSelect() < 2) {
      discountAmount=(this.computeDiscount(invoiceLine,invoice).subtract((invoiceLine.getProduct().getCostPrice()))).multiply(new BigDecimal(100)).divide(invoiceLine.getProduct().getCostPrice());
    }
  }
  if (invoiceLine.getProduct().getInAti() && !invoice.getInAti()) {
    discountAmount=discountAmount.divide(invoiceLine.getTaxLine().getValue().add(new BigDecimal(1)),2,BigDecimal.ROUND_HALF_UP);
  }
 else   if (!invoiceLine.getProduct().getInAti() && invoice.getInAti()) {
    discountAmount=discountAmount.add(discountAmount.multiply(invoiceLine.getTaxLine().getValue()));
  }
  return discountAmount;
}
Program: 58931
Project: 58931
Buggy source:
public BigDecimal convertUnitPrice(InvoiceLine invoiceLine,Invoice invoice){
  BigDecimal price=invoiceLine.getProduct().getSalePrice();
  if (invoice.getOperationTypeSelect() < 2) {
    price=invoiceLine.getProduct().getPurchasePrice();
  }
  if (invoiceLine.getProduct().getInAti() && !invoice.getInAti()) {
    price=price.subtract(price.multiply(invoiceLine.getTaxLine().getValue()));
  }
 else   if (!invoiceLine.getProduct().getInAti() && invoice.getInAti()) {
    price=price.add(price.multiply(invoiceLine.getTaxLine().getValue()));
  }
  return price;
}

Fixed version (ground truth):
public BigDecimal convertUnitPrice(InvoiceLine invoiceLine,Invoice invoice){
  BigDecimal price=invoiceLine.getProduct().getSalePrice();
  if (invoice.getOperationTypeSelect() < 2) {
    price=invoiceLine.getProduct().getPurchasePrice();
  }
  if (invoiceLine.getProduct().getInAti() && !invoice.getInAti()) {
    price=price.divide(invoiceLine.getTaxLine().getValue().add(new BigDecimal(1)),2,BigDecimal.ROUND_HALF_UP);
  }
 else   if (!invoiceLine.getProduct().getInAti() && invoice.getInAti()) {
    price=price.add(price.multiply(invoiceLine.getTaxLine().getValue()));
  }
  return price;
}
Program: 58932
Project: 58932
Buggy source:
public BigDecimal computeDiscount(InvoiceLine invoiceLine){
  BigDecimal unitPrice=invoiceLine.getPrice();
  if (invoiceLine.getDiscountTypeSelect() == IPriceListLine.AMOUNT_TYPE_FIXED) {
    return unitPrice.add(invoiceLine.getDiscountAmount());
  }
 else   if (invoiceLine.getDiscountTypeSelect() == IPriceListLine.AMOUNT_TYPE_PERCENT) {
    return unitPrice.multiply(BigDecimal.ONE.add(invoiceLine.getDiscountAmount().divide(new BigDecimal(100))));
  }
  return unitPrice;
}

Fixed version (ground truth):
public BigDecimal computeDiscount(InvoiceLine invoiceLine,Invoice invoice){
  BigDecimal unitPrice=BigDecimal.ZERO;
  if (invoice.getOperationTypeSelect() < InvoiceRepository.OPERATION_TYPE_CLIENT_SALE) {
    unitPrice=invoiceLine.getProduct().getCostPrice();
  }
  if (invoice.getOperationTypeSelect() >= InvoiceRepository.OPERATION_TYPE_CLIENT_SALE) {
    unitPrice=invoiceLine.getProduct().getSalePrice();
  }
  if (invoiceLine.getDiscountTypeSelect() == IPriceListLine.AMOUNT_TYPE_FIXED) {
    return unitPrice.add(invoiceLine.getDiscountAmount());
  }
 else   if (invoiceLine.getDiscountTypeSelect() == IPriceListLine.AMOUNT_TYPE_PERCENT) {
    return unitPrice.multiply(BigDecimal.ONE.add(invoiceLine.getDiscountAmount().divide(new BigDecimal(100))));
  }
  return unitPrice;
}
Program: 58933
Project: 58933
Buggy source:
protected InvoiceGenerator(){
  this.inAti=Beans.get(AccountConfigRepository.class).all().filter("String_Node_Str",company).fetchOne().getInvoiceInAti();
  this.today=GeneralService.getTodayDate();
  this.journalService=new JournalService();
}

Fixed version (ground truth):
protected InvoiceGenerator(){
  this.today=GeneralService.getTodayDate();
  this.journalService=new JournalService();
}
Program: 58935
Project: 58935
Buggy source:
@Override public BigDecimal convertDiscountAmount(PurchaseOrderLine purchaseOrderLine,PurchaseOrder purchaseOrder){
  BigDecimal discountAmount=this.computeDiscount(purchaseOrderLine).subtract(purchaseOrderLine.getProduct().getPurchasePrice());
  if (purchaseOrderLine.getProduct().getInAti() && !purchaseOrder.getInAti()) {
    discountAmount=discountAmount.subtract(discountAmount.multiply(purchaseOrderLine.getTaxLine().getValue()));
  }
 else   if (!purchaseOrderLine.getProduct().getInAti() && purchaseOrder.getInAti()) {
    discountAmount=discountAmount.add(discountAmount.multiply(purchaseOrderLine.getTaxLine().getValue()));
  }
  return discountAmount;
}

Fixed version (ground truth):
@Override public BigDecimal convertDiscountAmount(PurchaseOrderLine purchaseOrderLine,PurchaseOrder purchaseOrder){
  BigDecimal discountAmount=BigDecimal.ZERO;
  if (purchaseOrderLine.getDiscountTypeSelect() == IPriceListLine.AMOUNT_TYPE_FIXED) {
    discountAmount=this.computeDiscount(purchaseOrderLine).subtract(purchaseOrderLine.getProduct().getSalePrice());
  }
 else {
    discountAmount=(this.computeDiscount(purchaseOrderLine).subtract((purchaseOrderLine.getProduct().getSalePrice()))).multiply(new BigDecimal(100)).divide(purchaseOrderLine.getProduct().getSalePrice());
  }
  if (purchaseOrderLine.getProduct().getInAti() && !purchaseOrder.getInAti()) {
    discountAmount=discountAmount.divide(purchaseOrderLine.getTaxLine().getValue().add(new BigDecimal(1)),2,BigDecimal.ROUND_HALF_UP);
  }
 else   if (!purchaseOrderLine.getProduct().getInAti() && purchaseOrder.getInAti()) {
    discountAmount=discountAmount.add(discountAmount.multiply(purchaseOrderLine.getTaxLine().getValue()));
  }
  return discountAmount;
}
Program: 58936
Project: 58936
Buggy source:
@Override public BigDecimal convertUnitPrice(PurchaseOrderLine purchaseOrderLine,PurchaseOrder purchaseOrder){
  BigDecimal price=purchaseOrderLine.getProduct().getPurchasePrice();
  if (purchaseOrderLine.getProduct().getInAti() && !purchaseOrder.getInAti()) {
    price=price.subtract(price.multiply(purchaseOrderLine.getTaxLine().getValue()));
  }
 else   if (!purchaseOrderLine.getProduct().getInAti() && purchaseOrder.getInAti()) {
    price=price.add(price.multiply(purchaseOrderLine.getTaxLine().getValue()));
  }
  return price;
}

Fixed version (ground truth):
@Override public BigDecimal convertUnitPrice(PurchaseOrderLine purchaseOrderLine,PurchaseOrder purchaseOrder){
  BigDecimal price=purchaseOrderLine.getProduct().getPurchasePrice();
  if (purchaseOrderLine.getProduct().getInAti() && !purchaseOrder.getInAti()) {
    price=price.divide(purchaseOrderLine.getTaxLine().getValue().add(new BigDecimal(1)),2,BigDecimal.ROUND_HALF_UP);
  }
 else   if (!purchaseOrderLine.getProduct().getInAti() && purchaseOrder.getInAti()) {
    price=price.add(price.multiply(purchaseOrderLine.getTaxLine().getValue()));
  }
  return price;
}
Program: 58937
Project: 58937
Buggy source:
public BigDecimal convertDiscountAmount(SaleOrderLine saleOrderLine,SaleOrder saleOrder){
  BigDecimal discountAmount=this.computeDiscount(saleOrderLine).subtract(saleOrderLine.getProduct().getSalePrice());
  if (saleOrderLine.getProduct().getInAti() && !saleOrder.getInAti()) {
    discountAmount=discountAmount.subtract(discountAmount.multiply(saleOrderLine.getTaxLine().getValue()));
  }
 else   if (!saleOrderLine.getProduct().getInAti() && saleOrder.getInAti()) {
    discountAmount=discountAmount.add(discountAmount.multiply(saleOrderLine.getTaxLine().getValue()));
  }
  return discountAmount;
}

Fixed version (ground truth):
public BigDecimal convertDiscountAmount(SaleOrderLine saleOrderLine,SaleOrder saleOrder){
  BigDecimal discountAmount=BigDecimal.ZERO;
  if (saleOrderLine.getDiscountTypeSelect() == IPriceListLine.AMOUNT_TYPE_FIXED) {
    discountAmount=this.computeDiscount(saleOrderLine).subtract(saleOrderLine.getProduct().getSalePrice());
  }
 else {
    discountAmount=(this.computeDiscount(saleOrderLine).subtract((saleOrderLine.getProduct().getSalePrice()))).multiply(new BigDecimal(100)).divide(saleOrderLine.getProduct().getSalePrice());
  }
  if (saleOrderLine.getProduct().getInAti() && !saleOrder.getInAti()) {
    discountAmount=discountAmount.divide(saleOrderLine.getTaxLine().getValue().add(new BigDecimal(1)),2,BigDecimal.ROUND_HALF_UP);
  }
 else   if (!saleOrderLine.getProduct().getInAti() && saleOrder.getInAti()) {
    discountAmount=discountAmount.add(discountAmount.multiply(saleOrderLine.getTaxLine().getValue()));
  }
  return discountAmount;
}
Program: 58938
Project: 58938
Buggy source:
public BigDecimal convertUnitPrice(SaleOrderLine saleOrderLine,SaleOrder saleOrder){
  BigDecimal price=saleOrderLine.getProduct().getSalePrice();
  if (saleOrderLine.getProduct().getInAti() && !saleOrder.getInAti()) {
    price=price.subtract(price.multiply(saleOrderLine.getTaxLine().getValue()));
  }
 else   if (!saleOrderLine.getProduct().getInAti() && saleOrder.getInAti()) {
    price=price.add(price.multiply(saleOrderLine.getTaxLine().getValue()));
  }
  return price;
}

Fixed version (ground truth):
public BigDecimal convertUnitPrice(SaleOrderLine saleOrderLine,SaleOrder saleOrder){
  BigDecimal price=saleOrderLine.getProduct().getSalePrice();
  if (saleOrderLine.getProduct().getInAti() && !saleOrder.getInAti()) {
    price=price.divide(saleOrderLine.getTaxLine().getValue().add(new BigDecimal(1)),2,BigDecimal.ROUND_HALF_UP);
  }
 else   if (!saleOrderLine.getProduct().getInAti() && saleOrder.getInAti()) {
    price=price.add(price.multiply(saleOrderLine.getTaxLine().getValue()));
  }
  return price;
}
Program: 58939
Project: 58939
Buggy source:
public void createInvoice(ActionRequest request,ActionResponse response){
  Project project=request.getContext().asType(Project.class);
  if (project != null) {
    try {
      Invoice invoice=projectInvoiceService.generateInvoice(project);
      if (invoice != null) {
        response.setReload(true);
        response.setFlash(I18n.get(com.axelor.apps.supplychain.exception.IExceptionMessage.PO_INVOICE_2));
      }
 else {
        response.setFlash(I18n.get(IExceptionMessage.PROJECT_INVOICE_1));
      }
    }
 catch (    Exception e) {
      TraceBackService.trace(response,e);
    }
  }
}

Fixed version (ground truth):
public void createInvoice(ActionRequest request,ActionResponse response){
  Project project=request.getContext().asType(Project.class);
  if (project != null) {
    try {
      Invoice invoice=projectInvoiceService.generateInvoice(Beans.get(ProjectRepository.class).find(project.getId()));
      if (invoice != null) {
        response.setReload(true);
        response.setFlash(I18n.get(com.axelor.apps.supplychain.exception.IExceptionMessage.PO_INVOICE_2));
      }
 else {
        response.setFlash(I18n.get(IExceptionMessage.PROJECT_INVOICE_1));
      }
    }
 catch (    Exception e) {
      TraceBackService.trace(response,e);
    }
  }
}
Program: 58941
Project: 58941
Buggy source:
@Override @Transactional(rollbackOn={AxelorException.class,Exception.class}) public Message createMessage(String model,int id,String subject,String content,EmailAddress fromEmailAddress,List<EmailAddress> replyToEmailAddressList,List<EmailAddress> toEmailAddressList,List<EmailAddress> ccEmailAddressList,List<EmailAddress> bccEmailAddressList,Set<MetaFile> metaFiles,String addressBlock,int mediaTypeSelect){
  Message message=super.createMessage(content,fromEmailAddress,model,id,null,0,getTodayLocalTime(),false,STATUS_DRAFT,subject,TYPE_SENT,replyToEmailAddressList,toEmailAddressList,ccEmailAddressList,bccEmailAddressList,addressBlock,mediaTypeSelect);
  message.setCompany(userService.getUserActiveCompany());
  return save(message);
}

Fixed version (ground truth):
@Override @Transactional(rollbackOn={AxelorException.class,Exception.class}) public Message createMessage(String model,int id,String subject,String content,EmailAddress fromEmailAddress,List<EmailAddress> replyToEmailAddressList,List<EmailAddress> toEmailAddressList,List<EmailAddress> ccEmailAddressList,List<EmailAddress> bccEmailAddressList,Set<MetaFile> metaFiles,String addressBlock,int mediaTypeSelect){
  Message message=super.createMessage(model,id,subject,content,fromEmailAddress,replyToEmailAddressList,toEmailAddressList,ccEmailAddressList,bccEmailAddressList,metaFiles,addressBlock,mediaTypeSelect);
  message.setCompany(userService.getUserActiveCompany());
  return save(message);
}
Program: 58942
Project: 58942
Buggy source:
@Override public Set<MetaFile> getMetaFiles(Template template) throws AxelorException, IOException {
  Set<MetaFile> metaFiles=super.getMetaFiles(template);
  if (template.getBirtTemplate() == null) {
    return metaFiles;
  }
  MetaFile birtMetaFile=generateMetaFile(maker,template.getBirtTemplate());
  if (birtMetaFile == null) {
    return metaFiles;
  }
  metaFiles.add(birtMetaFile);
  return metaFiles;
}

Fixed version (ground truth):
@Override public Set<MetaFile> getMetaFiles(Template template) throws AxelorException, IOException {
  Set<MetaFile> metaFiles=super.getMetaFiles(template);
  if (template.getBirtTemplate() == null) {
    return metaFiles;
  }
  MetaFile birtMetaFile=generateMetaFile(maker,template.getBirtTemplate());
  if (birtMetaFile == null) {
    return metaFiles;
  }
  metaFiles.add(birtMetaFile);
  log.debug("String_Node_Str",metaFiles);
  return metaFiles;
}
Program: 58943
Project: 58943
Buggy source:
public MetaFile generateMetaFile(TemplateMaker maker,BirtTemplate birtTemplate) throws AxelorException, IOException {
  File file=generateFile(maker,birtTemplate.getName(),birtTemplate.getTemplateLink(),birtTemplate.getFormat(),birtTemplate.getBirtTemplateParameterList());
  if (file == null) {
    return null;
  }
  Path filePath=file.toPath();
  MetaFile metaFile=new MetaFile();
  metaFile.setFileName(file.getName());
  metaFile.setMime(Files.probeContentType(filePath));
  metaFile.setSize(Files.size(filePath));
  metaFile.setFilePath(file.getName());
  return metaFile;
}

Fixed version (ground truth):
public MetaFile generateMetaFile(TemplateMaker maker,BirtTemplate birtTemplate) throws AxelorException, IOException {
  log.debug("String_Node_Str",birtTemplate.getName());
  File file=generateFile(maker,birtTemplate.getName(),birtTemplate.getTemplateLink(),birtTemplate.getFormat(),birtTemplate.getBirtTemplateParameterList());
  if (file == null) {
    return null;
  }
  Path filePath=file.toPath();
  MetaFile metaFile=new MetaFile();
  metaFile.setFileName(file.getName());
  metaFile.setMime(Files.probeContentType(filePath));
  metaFile.setSize(Files.size(filePath));
  metaFile.setFilePath(file.getName());
  return metaFile;
}
Program: 58944
Project: 58944
Buggy source:
public File generateFile(TemplateMaker maker,String name,String modelPath,String format,List<BirtTemplateParameter> birtTemplateParameterList) throws AxelorException {
  if (modelPath == null || modelPath.isEmpty()) {
    return null;
  }
  ReportSettings reportSettings=new ReportSettings(modelPath,format);
  for (  BirtTemplateParameter birtTemplateParameter : birtTemplateParameterList) {
    maker.setTemplate(birtTemplateParameter.getValue());
    reportSettings.addParam(birtTemplateParameter.getName(),maker.make());
  }
  String url=reportSettings.getUrl();
  LOG.debug("String_Node_Str",url);
  String urlNotExist=URLService.notExist(url.toString());
  if (urlNotExist != null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.TEMPLATE_MESSAGE_BASE_1)),IException.CONFIGURATION_ERROR);
  }
  final int random=new Random().nextInt();
  String fileName=name + "String_Node_Str" + random+ "String_Node_Str"+ format;
  try {
    return URLService.fileDownload(url,UPLOAD_PATH,fileName);
  }
 catch (  IOException e) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.TEMPLATE_MESSAGE_BASE_2),e),IException.CONFIGURATION_ERROR);
  }
}

Fixed version (ground truth):
public File generateFile(TemplateMaker maker,String name,String modelPath,String format,List<BirtTemplateParameter> birtTemplateParameterList) throws AxelorException {
  if (modelPath == null || modelPath.isEmpty()) {
    return null;
  }
  ReportSettings reportSettings=new ReportSettings(modelPath,format);
  for (  BirtTemplateParameter birtTemplateParameter : birtTemplateParameterList) {
    maker.setTemplate(birtTemplateParameter.getValue());
    reportSettings.addParam(birtTemplateParameter.getName(),maker.make());
  }
  String url=reportSettings.getUrl();
  log.debug("String_Node_Str",url);
  String urlNotExist=URLService.notExist(url.toString());
  if (urlNotExist != null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.TEMPLATE_MESSAGE_BASE_1)),IException.CONFIGURATION_ERROR);
  }
  final int random=new Random().nextInt();
  String fileName=name + "String_Node_Str" + random+ "String_Node_Str"+ format;
  try {
    return URLService.fileDownload(url,UPLOAD_PATH,fileName);
  }
 catch (  IOException e) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.TEMPLATE_MESSAGE_BASE_2),e),IException.CONFIGURATION_ERROR);
  }
}
Program: 58945
Project: 58945
Buggy source:
@Override @Transactional(rollbackOn=Exception.class) public void attachMetaFiles(Message message,Set<MetaFile> metaFiles){
  Preconditions.checkNotNull(message.getId());
  if (metaFiles == null || metaFiles.isEmpty()) {
    return;
  }
  Long messageId=message.getId();
  String messageObjectName=Message.class.getName();
  for (  MetaFile metaFile : metaFiles) {
    MetaAttachment metaAttachment=new MetaAttachment();
    metaAttachment.setObjectId(messageId);
    metaAttachment.setObjectName(messageObjectName);
    metaAttachment.setMetaFile(metaFile);
    metaAttachmentRepository.save(metaAttachment);
  }
}

Fixed version (ground truth):
@Override @Transactional(rollbackOn=Exception.class) public void attachMetaFiles(Message message,Set<MetaFile> metaFiles){
  Preconditions.checkNotNull(message.getId());
  if (metaFiles == null || metaFiles.isEmpty()) {
    return;
  }
  Long messageId=message.getId();
  String messageObjectName=Message.class.getName();
  log.debug("String_Node_Str",messageObjectName,messageId);
  for (  MetaFile metaFile : metaFiles) {
    MetaAttachment metaAttachment=new MetaAttachment();
    metaAttachment.setObjectId(messageId);
    metaAttachment.setObjectName(messageObjectName);
    metaAttachment.setMetaFile(metaFile);
    metaAttachmentRepository.save(metaAttachment);
  }
}
Program: 58947
Project: 58947
Buggy source:
@Transactional(rollbackOn=Exception.class) public Message sendToUser(Message message){
  if (message.getRecipientUser() == null) {
    return message;
  }
  message.setSenderUser(AuthUtils.getUser());
  LOG.debug("String_Node_Str",message.getRecipientUser());
  message.setStatusSelect(MessageRepository.STATUS_SENT);
  message.setSentByEmail(false);
  message.setSentDateT(LocalDateTime.now());
  return save(message);
}

Fixed version (ground truth):
@Transactional(rollbackOn=Exception.class) public Message sendToUser(Message message){
  if (message.getRecipientUser() == null) {
    return message;
  }
  message.setSenderUser(AuthUtils.getUser());
  log.debug("String_Node_Str",message.getRecipientUser());
  message.setStatusSelect(MessageRepository.STATUS_SENT);
  message.setSentByEmail(false);
  message.setSentDateT(LocalDateTime.now());
  return save(message);
}