nus-yam/ex-repair huggingface dataset:
Program: 58612
Project: 58612
Buggy source:
public long computeMachineDuration(OperationOrder operationOrder,BigDecimal qty){
  ProdProcessLine prodProcessLine=operationOrder.getProdProcessLine();
  WorkCenter workCenter=prodProcessLine.getWorkCenter();
  long duration=0;
  int workCenterTypeSelect=workCenter.getWorkCenterTypeSelect();
  if (workCenterTypeSelect == IWorkCenter.WORK_CENTER_MACHINE || workCenterTypeSelect == IWorkCenter.WORK_CENTER_BOTH) {
    Machine machine=workCenter.getMachine();
    duration+=machine.getStartingDuration();
    BigDecimal durationPerCycle=new BigDecimal(prodProcessLine.getDurationPerCycle());
    BigDecimal maxCapacityPerCycle=prodProcessLine.getMaxCapacityPerCycle();
    if (maxCapacityPerCycle.compareTo(BigDecimal.ZERO) == 0) {
      duration+=qty.multiply(durationPerCycle).longValue();
    }
 else {
      duration+=(qty.divide(maxCapacityPerCycle)).multiply(durationPerCycle).longValue();
    }
    duration+=machine.getEndingDuration();
  }
  return duration;
}

Fixed version (ground truth):
public long computeMachineDuration(OperationOrder operationOrder,BigDecimal qty){
  ProdProcessLine prodProcessLine=operationOrder.getProdProcessLine();
  WorkCenter workCenter=prodProcessLine.getWorkCenter();
  long duration=0;
  int workCenterTypeSelect=workCenter.getWorkCenterTypeSelect();
  if (workCenterTypeSelect == IWorkCenter.WORK_CENTER_MACHINE || workCenterTypeSelect == IWorkCenter.WORK_CENTER_BOTH) {
    Machine machine=workCenter.getMachine();
    duration+=machine.getStartingDuration();
    BigDecimal durationPerCycle=new BigDecimal(prodProcessLine.getDurationPerCycle());
    BigDecimal maxCapacityPerCycle=prodProcessLine.getMaxCapacityPerCycle();
    if (maxCapacityPerCycle.compareTo(BigDecimal.ZERO) == 0) {
      duration+=qty.multiply(durationPerCycle).longValue();
    }
 else {
      duration+=(qty.divide(maxCapacityPerCycle,RoundingMode.HALF_UP)).multiply(durationPerCycle).longValue();
    }
    duration+=machine.getEndingDuration();
  }
  return duration;
}
Program: 58613
Project: 58613
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()) && !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);
}

Fixed version (ground truth):
/** 
 * Détermine le numéro de facture
 * @param sequence
 * @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: 58614
Project: 58614
Buggy source:
/** 
 * Détermine le numéro de facture
 * @param invoice
 * @param company
 * @throws AxelorException
 */
protected void setStatus(){
  invoice.setStatusSelect(InvoiceRepository.STATUS_VENTILATED);
}

Fixed version (ground truth):
/** 
 * Détermine le numéro de facture
 * @throws AxelorException
 */
protected void setStatus(){
  invoice.setStatusSelect(InvoiceRepository.STATUS_VENTILATED);
}
Program: 58615
Project: 58615
Buggy source:
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public AccountingSituation updateAccountingSituationCustomerAccount(AccountingSituation accountingSituation,boolean updateCustAccount,boolean updateDueCustAccount,boolean updateDueReminderCustAccount){
  Partner partner=accountingSituation.getPartner();
  Company company=accountingSituation.getCompany();
  log.debug("String_Node_Str",partner.getName(),company.getName(),updateCustAccount,updateDueReminderCustAccount);
  if (updateCustAccount) {
    accountingSituation.setBalanceCustAccount(this.getBalance(partner,company));
  }
  if (updateDueCustAccount) {
    accountingSituation.setBalanceDueCustAccount(this.getBalanceDue(partner,company));
  }
  if (updateDueReminderCustAccount) {
    accountingSituation.setBalanceDueReminderCustAccount(this.getBalanceDueReminder(partner,company));
  }
  accountingSituation.setCustAccountMustBeUpdateOk(false);
  accSituationRepo.save(accountingSituation);
  return accountingSituation;
}

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public AccountingSituation updateAccountingSituationCustomerAccount(AccountingSituation accountingSituation,boolean updateCustAccount,boolean updateDueCustAccount,boolean updateDueReminderCustAccount){
  Partner partner=accountingSituation.getPartner();
  Company company=accountingSituation.getCompany();
  log.debug("String_Node_Str",partner.getName(),company.getName(),updateCustAccount,updateDueCustAccount,updateDueReminderCustAccount);
  if (updateCustAccount) {
    accountingSituation.setBalanceCustAccount(this.getBalance(partner,company));
  }
  if (updateDueCustAccount) {
    accountingSituation.setBalanceDueCustAccount(this.getBalanceDue(partner,company));
  }
  if (updateDueReminderCustAccount) {
    accountingSituation.setBalanceDueReminderCustAccount(this.getBalanceDueReminder(partner,company));
  }
  accountingSituation.setCustAccountMustBeUpdateOk(false);
  accSituationRepo.save(accountingSituation);
  return accountingSituation;
}
Program: 58616
Project: 58616
Buggy source:
/** 
 * Creates the domain for the bank details in Accounting Situation
 * @param accountingSituation
 * @param isInBankDetails  true if the field is companyInBankDetailsfalse if the field is companyOutBankDetails
 * @return the domain of the bank details field
 */
public String createDomainForBankDetails(AccountingSituation accountingSituation,boolean isInBankDetails){
  String domain="String_Node_Str";
  List<BankDetails> authorizedBankDetails;
  if (isInBankDetails) {
    authorizedBankDetails=Beans.get(PaymentModeService.class).getCompatibleBankDetailsList(accountingSituation.getPartner().getInPaymentMode(),accountingSituation.getCompany());
  }
 else {
    authorizedBankDetails=Beans.get(PaymentModeService.class).getCompatibleBankDetailsList(accountingSituation.getPartner().getOutPaymentMode(),accountingSituation.getCompany());
  }
  String idList=Beans.get(BankDetailsService.class).getIdStringListFromCollection(authorizedBankDetails);
  if (idList.equals("String_Node_Str")) {
    return domain;
  }
  domain="String_Node_Str" + idList + "String_Node_Str";
  return domain;
}

Fixed version (ground truth):
/** 
 * Creates the domain for the bank details in Accounting Situation
 * @param accountingSituation
 * @param isInBankDetails  true if the field is companyInBankDetailsfalse if the field is companyOutBankDetails
 * @return the domain of the bank details field
 */
public String createDomainForBankDetails(AccountingSituation accountingSituation,boolean isInBankDetails){
  String domain="String_Node_Str";
  List<BankDetails> authorizedBankDetails;
  if (accountingSituation.getPartner() != null) {
    if (isInBankDetails) {
      authorizedBankDetails=Beans.get(PaymentModeService.class).getCompatibleBankDetailsList(accountingSituation.getPartner().getInPaymentMode(),accountingSituation.getCompany());
    }
 else {
      authorizedBankDetails=Beans.get(PaymentModeService.class).getCompatibleBankDetailsList(accountingSituation.getPartner().getOutPaymentMode(),accountingSituation.getCompany());
    }
    String idList=Beans.get(BankDetailsService.class).getIdStringListFromCollection(authorizedBankDetails);
    if (idList.equals("String_Node_Str")) {
      return domain;
    }
    domain="String_Node_Str" + idList + "String_Node_Str";
  }
  return domain;
}
Program: 58617
Project: 58617
Buggy source:
public AccountingSituation getAccountingSituation(Partner partner,Company company){
  if (partner.getAccountingSituationList() == null) {
    return null;
  }
  for (  AccountingSituation accountingSituation : partner.getAccountingSituationList()) {
    if (accountingSituation.getCompany().equals(company)) {
      return accountingSituation;
    }
  }
  return null;
}

Fixed version (ground truth):
public AccountingSituation getAccountingSituation(Partner partner,Company company){
  if (partner == null || partner.getAccountingSituationList() == null) {
    return null;
  }
  for (  AccountingSituation accountingSituation : partner.getAccountingSituationList()) {
    if (accountingSituation.getCompany().equals(company)) {
      return accountingSituation;
    }
  }
  return null;
}
Program: 58618
Project: 58618
Buggy source:
@Override public void computeAvgPriceForProduct(Product product,LocationLine unsavedLocationLine){
  Long productId=product.getId();
  String query="String_Node_Str" + "String_Node_Str" + productId + "String_Node_Str"+ LocationRepository.TYPE_VIRTUAL;
  int scale=Beans.get(AppBaseService.class).getNbDecimalDigitForUnitPrice();
  BigDecimal productAvgPrice=BigDecimal.ZERO;
  BigDecimal qtyTot=BigDecimal.ZERO;
  List<List<Object>> results=JPA.em().createQuery(query).getResultList();
  if (results.size() == 0) {
    return;
  }
  for (  List<Object> result : results) {
    BigDecimal avgPrice=(BigDecimal)result.get(1);
    BigDecimal qty=(BigDecimal)result.get(2);
    if (result.get(0).equals(unsavedLocationLine.getId())) {
      avgPrice=unsavedLocationLine.getAvgPrice();
      qty=unsavedLocationLine.getCurrentQty();
    }
    productAvgPrice=productAvgPrice.add(avgPrice.multiply(qty));
    qtyTot=qtyTot.add(qty);
  }
  productAvgPrice=productAvgPrice.divide(qtyTot,scale,BigDecimal.ROUND_HALF_UP);
  product.setAvgPrice(productAvgPrice);
  productRepo.save(product);
}

Fixed version (ground truth):
@Override public void computeAvgPriceForProduct(Product product,LocationLine unsavedLocationLine){
  Long productId=product.getId();
  String query="String_Node_Str" + "String_Node_Str" + productId + "String_Node_Str"+ LocationRepository.TYPE_VIRTUAL;
  int scale=Beans.get(AppBaseService.class).getNbDecimalDigitForUnitPrice();
  BigDecimal productAvgPrice=BigDecimal.ZERO;
  BigDecimal qtyTot=BigDecimal.ZERO;
  List<List<Object>> results=JPA.em().createQuery(query).getResultList();
  if (results.size() == 0) {
    return;
  }
  for (  List<Object> result : results) {
    BigDecimal avgPrice=(BigDecimal)result.get(1);
    BigDecimal qty=(BigDecimal)result.get(2);
    if (result.get(0).equals(unsavedLocationLine.getId())) {
      avgPrice=unsavedLocationLine.getAvgPrice();
      qty=unsavedLocationLine.getCurrentQty();
    }
    productAvgPrice=productAvgPrice.add(avgPrice.multiply(qty));
    qtyTot=qtyTot.add(qty);
  }
  if (qtyTot.equals(BigDecimal.ZERO)) {
    return;
  }
  productAvgPrice=productAvgPrice.divide(qtyTot,scale,BigDecimal.ROUND_HALF_UP);
  product.setAvgPrice(productAvgPrice);
  productRepo.save(product);
}
Program: 58619
Project: 58619
Buggy source:
@Override public void computeAvgPriceForProduct(Product product,LocationLine unsavedLocationLine){
  Long productId=product.getId();
  String query="String_Node_Str" + "String_Node_Str" + productId + "String_Node_Str"+ LocationRepository.TYPE_VIRTUAL;
  int scale=Beans.get(AppBaseService.class).getNbDecimalDigitForUnitPrice();
  BigDecimal productAvgPrice=BigDecimal.ZERO;
  BigDecimal qtyTot=BigDecimal.ZERO;
  List<List<Object>> results=JPA.em().createQuery(query).getResultList();
  if (results.size() == 0) {
    return;
  }
  for (  List<Object> result : results) {
    BigDecimal avgPrice=(BigDecimal)result.get(1);
    BigDecimal qty=(BigDecimal)result.get(2);
    if (result.get(0).equals(unsavedLocationLine.getId())) {
      avgPrice=unsavedLocationLine.getAvgPrice();
      qty=unsavedLocationLine.getCurrentQty();
    }
    productAvgPrice=productAvgPrice.add(avgPrice.multiply(qty));
    qtyTot=qtyTot.add(qty);
  }
  productAvgPrice=productAvgPrice.divide(qtyTot,scale,BigDecimal.ROUND_HALF_UP);
  product.setAvgPrice(productAvgPrice);
  productRepo.save(product);
}

Fixed version (ground truth):
@Override public void computeAvgPriceForProduct(Product product,LocationLine unsavedLocationLine){
  Long productId=product.getId();
  String query="String_Node_Str" + "String_Node_Str" + productId + "String_Node_Str"+ LocationRepository.TYPE_VIRTUAL;
  int scale=Beans.get(AppBaseService.class).getNbDecimalDigitForUnitPrice();
  BigDecimal productAvgPrice=BigDecimal.ZERO;
  BigDecimal qtyTot=BigDecimal.ZERO;
  List<List<Object>> results=JPA.em().createQuery(query).getResultList();
  if (results.isEmpty()) {
    return;
  }
  for (  List<Object> result : results) {
    BigDecimal avgPrice;
    BigDecimal qty;
    if (result.get(0).equals(unsavedLocationLine.getId())) {
      avgPrice=unsavedLocationLine.getAvgPrice();
      qty=unsavedLocationLine.getCurrentQty();
    }
 else {
      avgPrice=(BigDecimal)result.get(1);
      qty=(BigDecimal)result.get(2);
    }
    productAvgPrice=productAvgPrice.add(avgPrice.multiply(qty));
    qtyTot=qtyTot.add(qty);
  }
  if (qtyTot.compareTo(BigDecimal.ZERO) != 0) {
    productAvgPrice=productAvgPrice.divide(qtyTot,scale,BigDecimal.ROUND_HALF_UP);
  }
  product.setAvgPrice(productAvgPrice);
  productRepo.save(product);
}
Program: 58620
Project: 58620
Buggy source:
@SuppressWarnings("String_Node_Str") public void editExpenseSelected(ActionRequest request,ActionResponse response){
  Map<String,String> expenseMap=(Map<String,String>)request.getContext().get("String_Node_Str");
  Long expenseId=Long.parseLong(expenseMap.get("String_Node_Str"));
  response.setView(ActionView.define(I18n.get("String_Node_Str")).model(Expense.class.getName()).add("String_Node_Str","String_Node_Str").param("String_Node_Str","String_Node_Str").domain("String_Node_Str" + expenseId).context("String_Node_Str",expenseId).map());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void editExpenseSelected(ActionRequest request,ActionResponse response){
  Map<String,Object> expenseMap=(Map<String,Object>)request.getContext().get("String_Node_Str");
  Long expenseId=new Long((Integer)expenseMap.get("String_Node_Str"));
  response.setView(ActionView.define(I18n.get("String_Node_Str")).model(Expense.class.getName()).add("String_Node_Str","String_Node_Str").param("String_Node_Str","String_Node_Str").domain("String_Node_Str" + expenseId).context("String_Node_Str",expenseId).map());
}
Program: 58621
Project: 58621
Buggy source:
@SuppressWarnings("String_Node_Str") public void editLeaveSelected(ActionRequest request,ActionResponse response){
  Map<String,String> leaveMap=(Map<String,String>)request.getContext().get("String_Node_Str");
  Long leaveId=Long.parseLong(leaveMap.get("String_Node_Str"));
  response.setView(ActionView.define(I18n.get("String_Node_Str")).model(LeaveRequest.class.getName()).add("String_Node_Str","String_Node_Str").param("String_Node_Str","String_Node_Str").domain("String_Node_Str" + leaveId).context("String_Node_Str",leaveId).map());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void editLeaveSelected(ActionRequest request,ActionResponse response){
  Map<String,Object> leaveMap=(Map<String,Object>)request.getContext().get("String_Node_Str");
  Long leaveId=new Long((Integer)leaveMap.get("String_Node_Str"));
  response.setView(ActionView.define(I18n.get("String_Node_Str")).model(LeaveRequest.class.getName()).add("String_Node_Str","String_Node_Str").param("String_Node_Str","String_Node_Str").domain("String_Node_Str" + leaveId).context("String_Node_Str",leaveId).map());
}
Program: 58626
Project: 58626
Buggy source:
@Override public BankOrder save(BankOrder entity){
  try {
    BankOrderService bankOrderService=Beans.get(BankOrderService.class);
    bankOrderService.generateSequence(entity);
    if (entity.getGeneratedMetaFile() == null && (entity.getStatusSelect() == BankOrderRepository.STATUS_DRAFT || entity.getStatusSelect() == BankOrderRepository.STATUS_AWAITING_SIGNATURE)) {
      bankOrderService.updateTotalAmounts(entity);
    }
    return super.save(entity);
  }
 catch (  Exception e) {
    throw new PersistenceException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
@Override public BankOrder save(BankOrder entity){
  try {
    BankOrderService bankOrderService=Beans.get(BankOrderService.class);
    bankOrderService.generateSequence(entity);
    if (entity.getGeneratedMetaFile() == null && entity.getStatusSelect() == BankOrderRepository.STATUS_DRAFT) {
      bankOrderService.updateTotalAmounts(entity);
    }
    return super.save(entity);
  }
 catch (  Exception e) {
    throw new PersistenceException(e.getLocalizedMessage());
  }
}
Program: 58627
Project: 58627
Buggy source:
@Inject public BankOrderLineService(BankDetailsRepository bankDetailsRepo){
  this.bankDetailsRepo=bankDetailsRepo;
}

Fixed version (ground truth):
@Inject public BankOrderLineService(BankDetailsRepository bankDetailsRepo,CurrencyService currencyService){
  this.bankDetailsRepo=bankDetailsRepo;
  this.currencyService=currencyService;
}
Program: 58628
Project: 58628
Buggy source:
@Override @Transactional(rollbackOn={AxelorException.class,Exception.class}) public ProjectTask copy(ProjectTask entity,boolean deep){
  ProjectTask project=super.copy(entity,false);
  project.setStatusSelect(STATE_PLANNED);
  save(project);
  return project;
}

Fixed version (ground truth):
@Override public ProjectTask copy(ProjectTask entity,boolean deep){
  ProjectTask project=super.copy(entity,false);
  project.setStatusSelect(STATE_PLANNED);
  return project;
}
Program: 58629
Project: 58629
Buggy source:
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void realize(BankOrder bankOrder) throws AxelorException {
  Beans.get(BankOrderMoveService.class).generateMoves(bankOrder);
  File signedFile=MetaFiles.getPath(bankOrder.getSignedMetaFile()).toFile();
  sendFile(bankOrder,signedFile);
  bankOrder.setStatusSelect(BankOrderRepository.STATUS_CARRIED_OUT);
  bankOrderRepo.save(bankOrder);
}

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void realize(BankOrder bankOrder) throws AxelorException {
  Beans.get(BankOrderMoveService.class).generateMoves(bankOrder);
  File fileToSend=null;
  if (bankOrder.getSignatoryEbicsUser().getEbicsTypeSelect() == EbicsUserRepository.EBICS_TYPE_TS) {
    fileToSend=MetaFiles.getPath(bankOrder.getSignedMetaFile()).toFile();
  }
 else {
    fileToSend=MetaFiles.getPath(bankOrder.getGeneratedMetaFile()).toFile();
  }
  sendFile(bankOrder,fileToSend);
  bankOrder.setStatusSelect(BankOrderRepository.STATUS_CARRIED_OUT);
  bankOrderRepo.save(bankOrder);
}
Program: 58630
Project: 58630
Buggy source:
public void checkPreconditions(BankOrderLine bankOrderLine) throws AxelorException {
  if (bankOrderLine.getBankOrder().getPartnerTypeSelect() == BankOrderRepository.PARTNER_TYPE_COMPANY) {
    if (bankOrderLine.getReceiverCompany() == null) {
      throw new AxelorException(I18n.get(IExceptionMessage.BANK_ORDER_LINE_COMPANY_MISSING),IException.INCONSISTENCY);
    }
  }
  if (bankOrderLine.getPartner() == null) {
    throw new AxelorException(I18n.get(IExceptionMessage.BANK_ORDER_LINE_PARTNER_MISSING),IException.INCONSISTENCY);
  }
  if (bankOrderLine.getReceiverBankDetails() == null) {
    throw new AxelorException(I18n.get(IExceptionMessage.BANK_ORDER_LINE_COMPANY_MISSING),IException.INCONSISTENCY);
  }
  if (bankOrderLine.getBankOrderAmount().compareTo(BigDecimal.ZERO) <= 0) {
    throw new AxelorException(I18n.get(IExceptionMessage.BANK_ORDER_LINE_AMOUNT_NEGATIVE),IException.INCONSISTENCY);
  }
}

Fixed version (ground truth):
public void checkPreconditions(BankOrderLine bankOrderLine) throws AxelorException {
  if (bankOrderLine.getBankOrder().getPartnerTypeSelect() == BankOrderRepository.PARTNER_TYPE_COMPANY) {
    if (bankOrderLine.getReceiverCompany() == null) {
      throw new AxelorException(I18n.get(IExceptionMessage.BANK_ORDER_LINE_COMPANY_MISSING),IException.INCONSISTENCY);
    }
  }
  if (bankOrderLine.getPartner() == null) {
    throw new AxelorException(I18n.get(IExceptionMessage.BANK_ORDER_LINE_PARTNER_MISSING),IException.INCONSISTENCY);
  }
  if (bankOrderLine.getReceiverBankDetails() == null) {
    throw new AxelorException(I18n.get(IExceptionMessage.BANK_ORDER_LINE_BANK_DETAILS_MISSING),IException.INCONSISTENCY);
  }
  if (bankOrderLine.getBankOrderAmount().compareTo(BigDecimal.ZERO) <= 0) {
    throw new AxelorException(I18n.get(IExceptionMessage.BANK_ORDER_LINE_AMOUNT_NEGATIVE),IException.INCONSISTENCY);
  }
}
Program: 58632
Project: 58632
Buggy source:
public BigDecimal computeCompanyCurrencyAmount(BankOrder bankOrder,BankOrderLine bankOrderLine) throws AxelorException {
  LocalDate bankOrderDate=bankOrder.getBankOrderDate();
  if (bankOrder.getIsMultiDate()) {
    bankOrderDate=bankOrderLine.getBankOrderDate();
  }
  return currencyService.getAmountCurrencyConvertedAtDate(bankOrderLine.getBankOrderCurrency(),bankOrder.getCompanyCurrency(),bankOrderLine.getBankOrderAmount(),bankOrderDate).setScale(2,RoundingMode.HALF_UP);
}

Fixed version (ground truth):
public BigDecimal computeCompanyCurrencyAmount(BankOrder bankOrder,BankOrderLine bankOrderLine) throws AxelorException {
  LocalDate bankOrderDate=bankOrder.getBankOrderDate();
  if (bankOrder.getIsMultiDate()) {
    bankOrderDate=bankOrderLine.getBankOrderDate();
  }
  Currency bankOrderCurrency=bankOrder.getBankOrderCurrency();
  if (bankOrder.getIsMultiCurrency()) {
    bankOrderCurrency=bankOrderLine.getBankOrderCurrency();
  }
  return currencyService.getAmountCurrencyConvertedAtDate(bankOrderCurrency,bankOrder.getCompanyCurrency(),bankOrderLine.getBankOrderAmount(),bankOrderDate).setScale(2,RoundingMode.HALF_UP);
}
Program: 58633
Project: 58633
Buggy source:
public void confirm(ActionRequest request,ActionResponse response){
  try {
    BankOrder bankOrder=request.getContext().asType(BankOrder.class);
    bankOrder=bankOrderRepo.find(bankOrder.getId());
    if (bankOrder != null) {
      bankOrderService.confirm(bankOrder);
      response.setReload(true);
    }
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
public void confirm(ActionRequest request,ActionResponse response){
  try {
    BankOrder bankOrder=request.getContext().asType(BankOrder.class);
    bankOrder=bankOrderRepo.find(bankOrder.getId());
    if (bankOrder != null) {
      bankOrderService.confirm(bankOrder);
    }
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
  response.setReload(true);
}
Program: 58634
Project: 58634
Buggy source:
public void realize(ActionRequest request,ActionResponse response){
  try {
    BankOrder bankOrder=request.getContext().asType(BankOrder.class);
    bankOrder=bankOrderRepo.find(bankOrder.getId());
    if (bankOrder != null) {
      bankOrderService.realize(bankOrder);
      response.setReload(true);
    }
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
public void realize(ActionRequest request,ActionResponse response){
  try {
    BankOrder bankOrder=request.getContext().asType(BankOrder.class);
    bankOrder=bankOrderRepo.find(bankOrder.getId());
    if (bankOrder != null) {
      bankOrderService.realize(bankOrder);
    }
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
  response.setReload(true);
}
Program: 58637
Project: 58637
Buggy source:
/** 
 * Method to cancel an invoice Payment Cancel the eventual Move and Reconcile Compute the total amount paid on the linked invoice Change the status to cancel
 * @param invoicePayment An invoice payment
 * @throws AxelorException
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void cancel(InvoicePayment invoicePayment) throws AxelorException {
  Move paymentMove=invoicePayment.getMove();
  BankOrder paymentBankOrder=invoicePayment.getBankOrder();
  Reconcile reconcile=invoicePayment.getReconcile();
  if (paymentBankOrder != null) {
    if (paymentBankOrder.getStatusSelect() == BankOrderRepository.STATUS_CARRIED_OUT || paymentBankOrder.getStatusSelect() == BankOrderRepository.STATUS_REJECTED) {
      throw new AxelorException(I18n.get(IExceptionMessage.INVOICE_PAYMENT_CANCEL),IException.FUNCTIONNAL);
    }
 else {
      bankOrderService.cancelBankOrder(paymentBankOrder);
      this.updateCancelStatus(invoicePayment);
    }
  }
 else {
    log.debug("String_Node_Str",reconcile);
    if (reconcile != null && reconcile.getStatusSelect() == ReconcileRepository.STATUS_CONFIRMED) {
      reconcileService.unreconcile(reconcile);
      if (accountConfigService.getAccountConfig(invoicePayment.getInvoice().getCompany()).getAllowRemovalValidatedMove()) {
        invoicePayment.setReconcile(null);
        Beans.get(ReconcileRepository.class).remove(reconcile);
      }
    }
    if (paymentMove != null && invoicePayment.getTypeSelect() == InvoicePaymentRepository.TYPE_PAYMENT) {
      invoicePayment.setMove(null);
      moveCancelService.cancel(paymentMove);
    }
 else {
      this.updateCancelStatus(invoicePayment);
    }
  }
}

Fixed version (ground truth):
/** 
 * Method to cancel an invoice Payment Cancel the eventual Move and Reconcile Compute the total amount paid on the linked invoice Change the status to cancel
 * @param invoicePayment An invoice payment
 * @throws AxelorException
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void cancel(InvoicePayment invoicePayment) throws AxelorException {
  Move paymentMove=invoicePayment.getMove();
  Reconcile reconcile=invoicePayment.getReconcile();
  log.debug("String_Node_Str",reconcile);
  if (reconcile != null && reconcile.getStatusSelect() == ReconcileRepository.STATUS_CONFIRMED) {
    reconcileService.unreconcile(reconcile);
    if (accountConfigService.getAccountConfig(invoicePayment.getInvoice().getCompany()).getAllowRemovalValidatedMove()) {
      invoicePayment.setReconcile(null);
      Beans.get(ReconcileRepository.class).remove(reconcile);
    }
  }
  if (paymentMove != null && invoicePayment.getTypeSelect() == InvoicePaymentRepository.TYPE_PAYMENT) {
    invoicePayment.setMove(null);
    moveCancelService.cancel(paymentMove);
  }
 else {
    this.updateCancelStatus(invoicePayment);
  }
}
Program: 58638
Project: 58638
Buggy source:
@Inject public InvoicePaymentCancelServiceImpl(AccountConfigService accountConfigService,InvoicePaymentRepository invoicePaymentRepository,MoveCancelService moveCancelService,ReconcileService reconcileService,BankOrderService bankOrderService,InvoicePaymentToolService invoicePaymentToolService){
  this.accountConfigService=accountConfigService;
  this.invoicePaymentRepository=invoicePaymentRepository;
  this.moveCancelService=moveCancelService;
  this.reconcileService=reconcileService;
  this.bankOrderService=bankOrderService;
  this.invoicePaymentToolService=invoicePaymentToolService;
}

Fixed version (ground truth):
@Inject public InvoicePaymentCancelServiceImpl(AccountConfigService accountConfigService,InvoicePaymentRepository invoicePaymentRepository,MoveCancelService moveCancelService,ReconcileService reconcileService,InvoicePaymentToolService invoicePaymentToolService){
  this.accountConfigService=accountConfigService;
  this.invoicePaymentRepository=invoicePaymentRepository;
  this.moveCancelService=moveCancelService;
  this.reconcileService=reconcileService;
  this.invoicePaymentToolService=invoicePaymentToolService;
}
Program: 58639
Project: 58639
Buggy source:
@Inject public InvoicePaymentValidateServiceImpl(PaymentModeService paymentModeService,MoveService moveService,MoveLineService moveLineService,AccountConfigService accountConfigService,InvoicePaymentRepository invoicePaymentRepository,MoveCancelService moveCancelService,ReconcileService reconcileService,BankOrderCreateService bankOrderCreateService,BankOrderService bankOrderService,InvoicePaymentToolService invoicePaymentToolService){
  this.paymentModeService=paymentModeService;
  this.moveService=moveService;
  this.moveLineService=moveLineService;
  this.accountConfigService=accountConfigService;
  this.invoicePaymentRepository=invoicePaymentRepository;
  this.moveCancelService=moveCancelService;
  this.reconcileService=reconcileService;
  this.bankOrderCreateService=bankOrderCreateService;
  this.bankOrderService=bankOrderService;
  this.invoicePaymentToolService=invoicePaymentToolService;
}

Fixed version (ground truth):
@Inject public InvoicePaymentValidateServiceImpl(PaymentModeService paymentModeService,MoveService moveService,MoveLineService moveLineService,AccountConfigService accountConfigService,InvoicePaymentRepository invoicePaymentRepository,MoveCancelService moveCancelService,ReconcileService reconcileService,InvoicePaymentToolService invoicePaymentToolService){
  this.paymentModeService=paymentModeService;
  this.moveService=moveService;
  this.moveLineService=moveLineService;
  this.accountConfigService=accountConfigService;
  this.invoicePaymentRepository=invoicePaymentRepository;
  this.moveCancelService=moveCancelService;
  this.reconcileService=reconcileService;
  this.invoicePaymentToolService=invoicePaymentToolService;
}
Program: 58640
Project: 58640
Buggy source:
/** 
 * Method to validate an invoice Payment Create the eventual move (depending general configuration) and reconcile it with the invoice move Compute the amount paid on invoice Change the status to validated
 * @param invoicePayment An invoice payment
 * @throws AxelorException
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void validate(InvoicePayment invoicePayment) throws AxelorException {
  if (invoicePayment.getStatusSelect() != InvoicePaymentRepository.STATUS_DRAFT) {
    return;
  }
  PaymentMode paymentMode=invoicePayment.getPaymentMode();
  int typeSelect=paymentMode.getTypeSelect();
  int inOutSelect=paymentMode.getInOutSelect();
  if ((typeSelect == PaymentModeRepository.TYPE_DD || typeSelect == PaymentModeRepository.TYPE_TRANSFER) && inOutSelect == PaymentModeRepository.OUT) {
    invoicePayment.setStatusSelect(InvoicePaymentRepository.STATUS_PENDING);
  }
 else {
    invoicePayment.setStatusSelect(InvoicePaymentRepository.STATUS_VALIDATED);
  }
  Company company=invoicePayment.getInvoice().getCompany();
  if (accountConfigService.getAccountConfig(company).getGenerateMoveForInvoicePayment() && !paymentMode.getGenerateBankOrder()) {
    this.createMoveForInvoicePayment(invoicePayment);
  }
  if (paymentMode.getGenerateBankOrder()) {
    this.createBankOrder(invoicePayment);
  }
  invoicePaymentToolService.updateAmountPaid(invoicePayment.getInvoice());
  invoicePaymentRepository.save(invoicePayment);
}

Fixed version (ground truth):
/** 
 * Method to validate an invoice Payment Create the eventual move (depending general configuration) and reconcile it with the invoice move Compute the amount paid on invoice Change the status to validated
 * @param invoicePayment An invoice payment
 * @throws AxelorException
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void validate(InvoicePayment invoicePayment) throws AxelorException {
  if (invoicePayment.getStatusSelect() != InvoicePaymentRepository.STATUS_DRAFT) {
    return;
  }
  invoicePayment.setStatusSelect(InvoicePaymentRepository.STATUS_VALIDATED);
  Company company=invoicePayment.getInvoice().getCompany();
  if (accountConfigService.getAccountConfig(company).getGenerateMoveForInvoicePayment()) {
    this.createMoveForInvoicePayment(invoicePayment);
  }
  invoicePaymentToolService.updateAmountPaid(invoicePayment.getInvoice());
  invoicePaymentRepository.save(invoicePayment);
}
Program: 58641
Project: 58641
Buggy source:
@Override public void build() throws AxelorException {
  String bodyRetCode;
  super.build();
  bodyRetCode=response.getBody().getReturnCode().getStringValue();
  returnCode=ReturnCode.toReturnCode(bodyRetCode,"String_Node_Str");
  numSegments=(int)response.getHeader().getStatic().getNumSegments();
  segmentNumber=(int)response.getHeader().getMutable().getSegmentNumber().getLongValue();
  lastSegment=response.getHeader().getMutable().getSegmentNumber().getLastSegment();
  transactionKey=response.getBody().getDataTransfer().getDataEncryptionInfo().getTransactionKey();
  orderData=response.getBody().getDataTransfer().getOrderData().getByteArrayValue();
}

Fixed version (ground truth):
@Override public void build() throws AxelorException {
  String bodyRetCode;
  super.build();
  bodyRetCode=response.getBody().getReturnCode().getStringValue();
  returnCode=ReturnCode.toReturnCode(bodyRetCode,"String_Node_Str");
  numSegments=(int)response.getHeader().getStatic().getNumSegments();
  if (numSegments > 0) {
    segmentNumber=(int)response.getHeader().getMutable().getSegmentNumber().getLongValue();
    lastSegment=response.getHeader().getMutable().getSegmentNumber().getLastSegment();
    transactionKey=response.getBody().getDataTransfer().getDataEncryptionInfo().getTransactionKey();
    orderData=response.getBody().getDataTransfer().getOrderData().getByteArrayValue();
  }
}
Program: 58642
Project: 58642
Buggy source:
public Period getNextPeriod(Period period) throws AxelorException {
  Period nextPeriod=all().filter("String_Node_Str",period.getToDate(),period.getCompany(),PeriodRepository.STATUS_OPENED).fetchOne();
  if (nextPeriod == null || nextPeriod.getStatusSelect() == PeriodRepository.STATUS_CLOSED) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.PERIOD_1),period.getCompany().getName()),IException.CONFIGURATION_ERROR);
  }
  LOG.debug("String_Node_Str",nextPeriod);
  return period;
}

Fixed version (ground truth):
public Period getNextPeriod(Period period) throws AxelorException {
  Period nextPeriod=all().filter("String_Node_Str",period.getToDate(),period.getCompany(),PeriodRepository.STATUS_OPENED).fetchOne();
  if (nextPeriod == null || nextPeriod.getStatusSelect() == PeriodRepository.STATUS_CLOSED) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.PERIOD_1),period.getCompany().getName()),IException.CONFIGURATION_ERROR);
  }
  LOG.debug("String_Node_Str",nextPeriod);
  return nextPeriod;
}
Program: 58643
Project: 58643
Buggy source:
public KilometricLog getOrCreateKilometricLog(Employee employee,LocalDate date) throws AxelorException {
  KilometricLog log=getKilometricLog(employee,date);
  if (log != null) {
    return log;
  }
  Year year=Beans.get(YearServiceImpl.class).getYear(date,employee.getMainEmploymentContract().getPayCompany());
  if (year == null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.KILOMETRIC_LOG_NO_YEAR),employee.getUser().getActiveCompany(),date),IException.CONFIGURATION_ERROR);
  }
  return createKilometricLog(employee,new BigDecimal("String_Node_Str"),year);
}

Fixed version (ground truth):
public KilometricLog getOrCreateKilometricLog(Employee employee,LocalDate date) throws AxelorException {
  KilometricLog log=getKilometricLog(employee,date);
  if (log != null) {
    return log;
  }
  if (employee.getMainEmploymentContract() == null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.EMPLOYEE_CONTRACT_OF_EMPLOYMENT),employee.getName()),IException.CONFIGURATION_ERROR);
  }
  Year year=Beans.get(YearServiceImpl.class).getYear(date,employee.getMainEmploymentContract().getPayCompany());
  if (year == null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.KILOMETRIC_LOG_NO_YEAR),employee.getUser().getActiveCompany(),date),IException.CONFIGURATION_ERROR);
  }
  return createKilometricLog(employee,new BigDecimal("String_Node_Str"),year);
}
Program: 58644
Project: 58644
Buggy source:
@Transactional public void fillExpenseWithAdvances(Expense expense){
  Employee employee=Beans.get(EmployeeRepository.class).find(expense.getUser().getEmployee().getId());
  List<EmployeeAdvance> advanceList=Lists.newArrayList();
  advanceList=employeeAdvanceRepository.all().filter("String_Node_Str",employee.getId(),expense.getPeriod().getToDate(),EmployeeAdvanceRepository.STATUS_VALIDATED,EmployeeAdvanceRepository.TYPE_OCCASIONAL).fetch();
  if (advanceList != null && !advanceList.isEmpty()) {
    BigDecimal currentAmountToRefund=expense.getInTaxTotal().subtract(expense.getPersonalExpenseAmount()).subtract(expense.getWithdrawnCash());
    for (    EmployeeAdvance advance : advanceList) {
      if (currentAmountToRefund.compareTo(BigDecimal.ZERO) == 0) {
        break;
      }
      currentAmountToRefund=withdrawFromAdvance(advance,expense,currentAmountToRefund);
      employeeAdvanceRepository.save(advance);
    }
    expense.setAdvanceAmount(expense.getInTaxTotal().subtract(currentAmountToRefund));
  }
}

Fixed version (ground truth):
@Transactional public void fillExpenseWithAdvances(Expense expense){
  Employee employee=Beans.get(EmployeeRepository.class).find(expense.getUser().getEmployee().getId());
  List<EmployeeAdvance> advanceList=Lists.newArrayList();
  advanceList=employeeAdvanceRepository.all().filter("String_Node_Str",employee.getId(),expense.getPeriod().getToDate(),EmployeeAdvanceRepository.STATUS_VALIDATED,EmployeeAdvanceRepository.TYPE_OCCASIONAL).fetch();
  if (advanceList != null && !advanceList.isEmpty()) {
    BigDecimal currentAmountToRefund=expense.getInTaxTotal().subtract(expense.getPersonalExpenseAmount()).subtract(expense.getWithdrawnCash());
    for (    EmployeeAdvance advance : advanceList) {
      if (currentAmountToRefund.compareTo(BigDecimal.ZERO) == 0) {
        break;
      }
      currentAmountToRefund=withdrawFromAdvance(advance,expense,currentAmountToRefund);
      employeeAdvanceRepository.save(advance);
    }
    expense.setAdvanceAmount(expense.getInTaxTotal().subtract(currentAmountToRefund).subtract(expense.getPersonalExpenseAmount()).subtract(expense.getWithdrawnCash()));
  }
}
Program: 58645
Project: 58645
Buggy source:
public static PaymentMode getPaymentMode(Invoice invoice) throws AxelorException {
  Partner partner=invoice.getPartner();
  if (InvoiceToolService.isOutPayment(invoice)) {
    if (partner != null) {
      PaymentMode paymentMode=partner.getOutPaymentMode();
      if (paymentMode != null) {
        return paymentMode;
      }
    }
    return accountConfigService.getAccountConfig(invoice.getCompany()).getOutPaymentMode();
  }
 else {
    if (partner != null) {
      PaymentMode paymentMode=partner.getInPaymentMode();
      if (paymentMode != null) {
        return paymentMode;
      }
    }
    return accountConfigService.getAccountConfig(invoice.getCompany()).getInPaymentMode();
  }
}

Fixed version (ground truth):
public static PaymentMode getPaymentMode(Invoice invoice) throws AxelorException {
  Partner partner=invoice.getPartner();
  if (InvoiceToolService.isOutPayment(invoice)) {
    if (partner != null) {
      PaymentMode paymentMode=partner.getOutPaymentMode();
      if (paymentMode != null) {
        return paymentMode;
      }
    }
    return Beans.get(AccountConfigService.class).getAccountConfig(invoice.getCompany()).getOutPaymentMode();
  }
 else {
    if (partner != null) {
      PaymentMode paymentMode=partner.getInPaymentMode();
      if (paymentMode != null) {
        return paymentMode;
      }
    }
    return Beans.get(AccountConfigService.class).getAccountConfig(invoice.getCompany()).getInPaymentMode();
  }
}
Program: 58649
Project: 58649
Buggy source:
public void computeKilometricExpense(ActionRequest request,ActionResponse response) throws AxelorException {
  ExpenseLine expenseLine=request.getContext().asType(ExpenseLine.class);
  if (expenseLine.getKilometricAllowParam() == null || expenseLine.getDistance() == null || expenseLine.getExpenseDate() == null || expenseLine.getKilometricTypeSelect() == null || expenseLine.getKilometricTypeSelect() == 0 || expenseLine.getDistance() == null) {
    return;
  }
  String userId=null;
  String userName=null;
  if (expenseLine.getExpense() != null) {
    userId=expenseLine.getExpense().getUser().getId().toString();
    userName=expenseLine.getExpense().getUser().getFullName();
  }
 else {
    userId=request.getContext().getParentContext().asType(Expense.class).getUser().getId().toString();
    userName=request.getContext().getParentContext().asType(Expense.class).getUser().getFullName();
  }
  Employee employee=Beans.get(EmployeeRepository.class).all().filter("String_Node_Str",userId).fetchOne();
  if (employee == null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.LEAVE_USER_EMPLOYEE),userName),IException.CONFIGURATION_ERROR);
  }
  BigDecimal amount=Beans.get(KilometricService.class).computeKilometricExpense(expenseLine,employee);
  response.setValue("String_Node_Str",amount);
  response.setValue("String_Node_Str",amount);
}

Fixed version (ground truth):
public void computeKilometricExpense(ActionRequest request,ActionResponse response) throws AxelorException {
  ExpenseLine expenseLine=request.getContext().asType(ExpenseLine.class);
  if (expenseLine.getKilometricAllowParam() == null || expenseLine.getDistance() == null || expenseLine.getExpenseDate() == null || expenseLine.getKilometricTypeSelect() == null || expenseLine.getKilometricTypeSelect() == 0 || expenseLine.getDistance() == null) {
    return;
  }
  String userId=null;
  String userName=null;
  if (expenseLine.getExpense() != null) {
    userId=expenseLine.getExpense().getUser().getId().toString();
    userName=expenseLine.getExpense().getUser().getFullName();
  }
 else {
    userId=request.getContext().getParentContext().asType(Expense.class).getUser().getId().toString();
    userName=request.getContext().getParentContext().asType(Expense.class).getUser().getFullName();
  }
  Employee employee=Beans.get(EmployeeRepository.class).all().filter("String_Node_Str",userId).fetchOne();
  if (employee == null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.LEAVE_USER_EMPLOYEE),userName),IException.CONFIGURATION_ERROR);
  }
  BigDecimal amount=BigDecimal.ZERO;
  try {
    amount=Beans.get(KilometricService.class).computeKilometricExpense(expenseLine,employee);
  }
 catch (  AxelorException e) {
    TraceBackService.trace(response,e);
  }
  response.setValue("String_Node_Str",amount);
  response.setValue("String_Node_Str",amount);
}
Program: 58650
Project: 58650
Buggy source:
public KilometricLog getOrCreateKilometricLog(Employee employee,LocalDate date) throws AxelorException {
  KilometricLog log=getKilometricLog(employee,date);
  if (log != null) {
    return log;
  }
  Year year=Beans.get(YearRepository.class).all().filter("String_Node_Str",date,employee.getUser().getActiveCompany()).fetchOne();
  if (year == null) {
    throw new AxelorException(I18n.get(String.format(IExceptionMessage.KILOMETRIC_LOG_NO_YEAR,employee.getUser().getActiveCompany(),date)),IException.CONFIGURATION_ERROR);
  }
  return createKilometricLog(employee,new BigDecimal("String_Node_Str"),year);
}

Fixed version (ground truth):
public KilometricLog getOrCreateKilometricLog(Employee employee,LocalDate date) throws AxelorException {
  KilometricLog log=getKilometricLog(employee,date);
  if (log != null) {
    return log;
  }
  Year year=Beans.get(YearServiceImpl.class).getYear(date,employee.getMainEmploymentContract().getPayCompany());
  if (year == null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.KILOMETRIC_LOG_NO_YEAR),employee.getUser().getActiveCompany(),date),IException.CONFIGURATION_ERROR);
  }
  return createKilometricLog(employee,new BigDecimal("String_Node_Str"),year);
}
Program: 58652
Project: 58652
Buggy source:
@Override public Partner save(Partner partner){
  try {
    if (partner.getId() == null) {
      return super.save(partner);
    }
    if (!partner.getIsContact()) {
      List<AccountingSituation> accountingSituationList=Beans.get(AccountingSituationService.class).createAccountingSituation(Beans.get(PartnerRepository.class).find(partner.getId()));
      if (accountingSituationList != null) {
        partner.setAccountingSituationList(accountingSituationList);
      }
    }
    return super.save(partner);
  }
 catch (  Exception e) {
    throw new PersistenceException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
@Override public Partner save(Partner partner){
  try {
    if (partner.getId() == null) {
      return super.save(partner);
    }
    if (!partner.getIsContact() && appService.isApp("String_Node_Str")) {
      List<AccountingSituation> accountingSituationList=Beans.get(AccountingSituationService.class).createAccountingSituation(Beans.get(PartnerRepository.class).find(partner.getId()));
      if (accountingSituationList != null) {
        partner.setAccountingSituationList(accountingSituationList);
      }
    }
    return super.save(partner);
  }
 catch (  Exception e) {
    throw new PersistenceException(e.getLocalizedMessage());
  }
}
Program: 58653
Project: 58653
Buggy source:
@Override public Partner copy(Partner partner,boolean deep){
  Partner copy=super.copy(partner,deep);
  copy.setAccountingSituationList(null);
  return copy;
}

Fixed version (ground truth):
@Override public Partner copy(Partner partner,boolean deep){
  Partner copy=super.copy(partner,deep);
  if (appService.isApp("String_Node_Str")) {
    copy.setAccountingSituationList(null);
  }
  return copy;
}
Program: 58654
Project: 58654
Buggy source:
public Object clearAllMailMessages(Object bean,Map<String,Object> values){
  deleteMailMessages();
  return bean;
}

Fixed version (ground truth):
@Transactional public Object clearAllMailMessages(Object bean,Map<String,Object> values){
  for (  MailMessage mailMessage : mailRepo.all().fetch()) {
    try {
      mailRepo.remove(mailMessage);
    }
 catch (    Exception e) {
      LOG.debug("String_Node_Str",mailMessage.getId(),e.getMessage());
    }
  }
  return bean;
}
Program: 58655
Project: 58655
Buggy source:
public Object importAddress(Object bean,Map<String,Object> values){
}

Fixed version (ground truth):
public Object importAddress(Object bean,Map<String,Object> values){
  Address address=(Address)bean;
  address.setFullName(addressService.computeFullName(address));
  return address;
}
Program: 58656
Project: 58656
Buggy source:
public MoveLine computeAnalyticDistribution(MoveLine moveLine){
  List<AnalyticMoveLine> analyticDistributionLineList=moveLine.getAnalyticMoveLineList();
  if (analyticDistributionLineList != null && generalService.getGeneral().getAnalyticDistributionTypeSelect() != GeneralRepository.DISTRIBUTION_TYPE_FREE) {
    for (    AnalyticMoveLine analyticDistributionLine : analyticDistributionLineList) {
      analyticDistributionLine.setMoveLine(moveLine);
      analyticDistributionLine.setAmount(analyticMoveLineService.computeAmount(analyticDistributionLine));
      analyticDistributionLine.setDate(generalService.getTodayDate());
    }
  }
  return moveLine;
}

Fixed version (ground truth):
public MoveLine computeAnalyticDistribution(MoveLine moveLine){
  List<AnalyticMoveLine> analyticMoveLineList=moveLine.getAnalyticMoveLineList();
  if (analyticMoveLineList != null && generalService.getGeneral().getAnalyticDistributionTypeSelect() != GeneralRepository.DISTRIBUTION_TYPE_FREE) {
    for (    AnalyticMoveLine analyticDistributionLine : analyticMoveLineList) {
      analyticDistributionLine.setMoveLine(moveLine);
      analyticDistributionLine.setAmount(analyticMoveLineService.computeAmount(analyticDistributionLine));
      analyticDistributionLine.setDate(generalService.getTodayDate());
    }
  }
  return moveLine;
}