nus-yam/ex-repair huggingface dataset:
Program: 58746
Project: 58746
Buggy source:
@Transactional(rollbackOn={Exception.class}) public TimesheetLine generateTimesheetLine(TSTimer timer){
  BigDecimal durationHours=BigDecimal.valueOf(timer.getDuration() / 3600);
  Timesheet timesheet=timesheetService.getCurrentOrCreateTimesheet();
  TimesheetLine timesheetLine=timesheetService.createTimesheetLine(timer.getProjectTask(),timer.getProduct(),timer.getUser(),timer.getStartDateTime().toLocalDate(),timesheet,durationHours,timer.getComments());
  Beans.get(TimesheetRepository.class).save(timesheet);
  Beans.get(TimesheetLineRepository.class).save(timesheetLine);
  timer.setTimeSheetLine(timesheetLine);
  return timesheetLine;
}

Fixed version (ground truth):
@Transactional(rollbackOn={Exception.class}) public TimesheetLine generateTimesheetLine(TSTimer timer){
  BigDecimal durationHours=this.convertSecondDurationInHours(timer.getDuration());
  Timesheet timesheet=timesheetService.getCurrentOrCreateTimesheet();
  TimesheetLine timesheetLine=timesheetService.createTimesheetLine(timer.getProjectTask(),timer.getProduct(),timer.getUser(),timer.getStartDateTime().toLocalDate(),timesheet,durationHours,timer.getComments());
  Beans.get(TimesheetRepository.class).save(timesheet);
  Beans.get(TimesheetLineRepository.class).save(timesheetLine);
  timer.setTimesheetLine(timesheetLine);
  return timesheetLine;
}
Program: 58747
Project: 58747
Buggy source:
@Override public PurchaseOrder copy(PurchaseOrder entity,boolean deep){
  entity.setStatusSelect(IPurchaseOrder.STATUS_DRAFT);
  entity.setPurchaseOrderSeq(null);
  return super.copy(entity,deep);
}

Fixed version (ground truth):
@Override public PurchaseOrder copy(PurchaseOrder entity,boolean deep){
  entity.setStatusSelect(IPurchaseOrder.STATUS_DRAFT);
  entity.setPurchaseOrderSeq(null);
  entity.setVersionNumber(1);
  return super.copy(entity,deep);
}
Program: 58750
Project: 58750
Buggy source:
/** 
 * Méthode permettant d'employer les trop-perçus 2 cas : - le compte des trop-perçus est le même que celui de la facture : alors on lettre directement - le compte n'est pas le même : on créée une O.D. de passage sur le bon compte
 * @param invoice
 * @return
 * @throws AxelorException
 */
public Move createMoveUseExcessPaymentOrDue(Invoice invoice) throws AxelorException {
  Move move=null;
  if (invoice != null) {
    if (moveToolService.isDebitCustomer(invoice)) {
      this.createMoveUseExcessPayment(invoice);
    }
 else {
      this.createMoveUseInvoiceDue(invoice);
    }
  }
  return move;
}

Fixed version (ground truth):
/** 
 * Méthode permettant d'employer les trop-perçus 2 cas : - le compte des trop-perçus est le même que celui de la facture : alors on lettre directement - le compte n'est pas le même : on créée une O.D. de passage sur le bon compte
 * @param invoice
 * @return
 * @throws AxelorException
 */
public Move createMoveUseExcessPaymentOrDue(Invoice invoice) throws AxelorException {
  Move move=null;
  if (invoice != null) {
    if (moveToolService.isDebitCustomer(invoice,true)) {
      this.createMoveUseExcessPayment(invoice);
    }
 else {
      this.createMoveUseInvoiceDue(invoice);
    }
  }
  return move;
}
Program: 58751
Project: 58751
Buggy source:
/** 
 * Créer une écriture comptable propre à la facture.
 * @param invoice
 * @param consolidate
 * @return
 * @throws AxelorException
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public Move createMove(Invoice invoice) throws AxelorException {
  Move move=null;
  if (invoice != null && invoice.getInvoiceLineList() != null) {
    Journal journal=invoice.getJournal();
    Company company=invoice.getCompany();
    Partner partner=invoice.getPartner();
    Account account=invoice.getPartnerAccount();
    log.debug("String_Node_Str",new Object[]{invoice.getInvoiceId(),company.getName(),journal.getCode()});
    move=moveCreateService.createMove(journal,company,invoice,partner,invoice.getInvoiceDate(),invoice.getPaymentMode());
    if (move != null) {
      boolean isPurchase=InvoiceToolService.isPurchase(invoice);
      boolean isDebitCustomer=moveToolService.isDebitCustomer(invoice);
      boolean consolidate=moveToolService.toDoConsolidate();
      move.getMoveLineList().addAll(moveLineService.createMoveLines(invoice,move,company,partner,account,consolidate,isPurchase,isDebitCustomer));
      moveRepository.save(move);
      invoice.setMove(move);
      invoice.setCompanyInTaxTotalRemaining(moveToolService.getInTaxTotalRemaining(invoice));
      moveValidateService.validateMove(move);
    }
  }
  return move;
}

Fixed version (ground truth):
/** 
 * Créer une écriture comptable propre à la facture.
 * @param invoice
 * @param consolidate
 * @return
 * @throws AxelorException
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public Move createMove(Invoice invoice) throws AxelorException {
  Move move=null;
  if (invoice != null && invoice.getInvoiceLineList() != null) {
    Journal journal=invoice.getJournal();
    Company company=invoice.getCompany();
    Partner partner=invoice.getPartner();
    Account account=invoice.getPartnerAccount();
    log.debug("String_Node_Str",new Object[]{invoice.getInvoiceId(),company.getName(),journal.getCode()});
    move=moveCreateService.createMove(journal,company,invoice,partner,invoice.getInvoiceDate(),invoice.getPaymentMode());
    if (move != null) {
      boolean isPurchase=InvoiceToolService.isPurchase(invoice);
      boolean isDebitCustomer=moveToolService.isDebitCustomer(invoice,false);
      boolean consolidate=moveToolService.toDoConsolidate();
      move.getMoveLineList().addAll(moveLineService.createMoveLines(invoice,move,company,partner,account,consolidate,isPurchase,isDebitCustomer));
      moveRepository.save(move);
      invoice.setMove(move);
      invoice.setCompanyInTaxTotalRemaining(moveToolService.getInTaxTotalRemaining(invoice));
      moveValidateService.validateMove(move);
    }
  }
  return move;
}
Program: 58752
Project: 58752
Buggy source:
/** 
 * Fonction permettant de récuperer la ligne d'écriture (non complétement lettrée sur le compte client) de la facture Récupération par boucle. A privilégié si les lignes d'écriture sont déjà managées par JPA ou si le nombre de lignes d'écriture n'est pas important (< 100).
 * @param invoice Une facture
 * @return
 * @throws AxelorException
 */
public MoveLine getInvoiceCustomerMoveLineByLoop(Invoice invoice) throws AxelorException {
  if (this.isDebitCustomer(invoice)) {
    return moveLineService.getDebitCustomerMoveLine(invoice);
  }
 else {
    return moveLineService.getCreditCustomerMoveLine(invoice);
  }
}

Fixed version (ground truth):
/** 
 * Fonction permettant de récuperer la ligne d'écriture (non complétement lettrée sur le compte client) de la facture Récupération par boucle. A privilégié si les lignes d'écriture sont déjà managées par JPA ou si le nombre de lignes d'écriture n'est pas important (< 100).
 * @param invoice Une facture
 * @return
 * @throws AxelorException
 */
public MoveLine getInvoiceCustomerMoveLineByLoop(Invoice invoice) throws AxelorException {
  if (this.isDebitCustomer(invoice,true)) {
    return moveLineService.getDebitCustomerMoveLine(invoice);
  }
 else {
    return moveLineService.getCreditCustomerMoveLine(invoice);
  }
}
Program: 58753
Project: 58753
Buggy source:
/** 
 * Fonction permettant de récuperer la ligne d'écriture (non complétement lettrée sur le compte client) de la facture Récupération par requête. A privilégié si les lignes d'écritures ne sont pas managées par JPA ou si le nombre d'écriture est très important (> 100)
 * @param invoice Une facture
 * @return
 * @throws AxelorException
 */
public MoveLine getInvoiceCustomerMoveLineByQuery(Invoice invoice) throws AxelorException {
  if (this.isDebitCustomer(invoice)) {
    return moveLineRepository.all().filter("String_Node_Str",invoice.getMove(),invoice.getPartnerAccount()).fetchOne();
  }
 else {
    return moveLineRepository.all().filter("String_Node_Str",invoice.getMove(),invoice.getPartnerAccount()).fetchOne();
  }
}

Fixed version (ground truth):
/** 
 * Fonction permettant de récuperer la ligne d'écriture (non complétement lettrée sur le compte client) de la facture Récupération par requête. A privilégié si les lignes d'écritures ne sont pas managées par JPA ou si le nombre d'écriture est très important (> 100)
 * @param invoice Une facture
 * @return
 * @throws AxelorException
 */
public MoveLine getInvoiceCustomerMoveLineByQuery(Invoice invoice) throws AxelorException {
  if (this.isDebitCustomer(invoice,true)) {
    return moveLineRepository.all().filter("String_Node_Str",invoice.getMove(),invoice.getPartnerAccount()).fetchOne();
  }
 else {
    return moveLineRepository.all().filter("String_Node_Str",invoice.getMove(),invoice.getPartnerAccount()).fetchOne();
  }
}
Program: 58754
Project: 58754
Buggy source:
/** 
 * @param invoice OperationTypeSelect 1 : Achat fournisseur 2 : Avoir fournisseur 3 : Vente client 4 : Avoir client
 * @return
 * @throws AxelorException
 */
public boolean isDebitCustomer(Invoice invoice) throws AxelorException {
  boolean isDebitCustomer;
switch (invoice.getOperationTypeSelect()) {
case 1:
    isDebitCustomer=false;
  break;
case 2:
isDebitCustomer=true;
break;
case 3:
isDebitCustomer=true;
break;
case 4:
isDebitCustomer=false;
break;
default :
throw new AxelorException(String.format(I18n.get(IExceptionMessage.MOVE_1),invoice.getInvoiceId()),IException.MISSING_FIELD);
}
if (this.isMinus(invoice)) {
isDebitCustomer=!isDebitCustomer;
}
return isDebitCustomer;
}

Fixed version (ground truth):
/** 
 * @param invoice OperationTypeSelect 1 : Supplier invoice 2 : Supplier refund 3 : Customer invoice 4 : Customer refund
 * @return
 * @throws AxelorException
 */
public boolean isDebitCustomer(Invoice invoice,boolean reverseDirectionForNegativeAmount) throws AxelorException {
  boolean isDebitCustomer;
switch (invoice.getOperationTypeSelect()) {
case InvoiceRepository.OPERATION_TYPE_SUPPLIER_PURCHASE:
    isDebitCustomer=false;
  break;
case InvoiceRepository.OPERATION_TYPE_SUPPLIER_REFUND:
isDebitCustomer=true;
break;
case InvoiceRepository.OPERATION_TYPE_CLIENT_SALE:
isDebitCustomer=true;
break;
case InvoiceRepository.OPERATION_TYPE_CLIENT_REFUND:
isDebitCustomer=false;
break;
default :
throw new AxelorException(String.format(I18n.get(IExceptionMessage.MOVE_1),invoice.getInvoiceId()),IException.MISSING_FIELD);
}
if (reverseDirectionForNegativeAmount && this.isMinus(invoice)) {
isDebitCustomer=!isDebitCustomer;
}
return isDebitCustomer;
}
Program: 58755
Project: 58755
Buggy source:
public void reconcile(ActionRequest request,ActionResponse response){
  Reconcile reconcile=request.getContext().asType(Reconcile.class);
  try {
    reconcileService.confirmReconcile(reconcile);
    response.setReload(true);
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
public void reconcile(ActionRequest request,ActionResponse response){
  Reconcile reconcile=request.getContext().asType(Reconcile.class);
  try {
    reconcileService.confirmReconcile(reconcileRepo.find(reconcile.getId()));
    response.setReload(true);
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}
Program: 58756
Project: 58756
Buggy source:
public void unreconcile(ActionRequest request,ActionResponse response){
  Reconcile reconcile=request.getContext().asType(Reconcile.class);
  reconcile=reconcileRepo.find(reconcile.getId());
  try {
    reconcileService.unreconcile(reconcile);
    response.setReload(true);
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
public void unreconcile(ActionRequest request,ActionResponse response){
  Reconcile reconcile=request.getContext().asType(Reconcile.class);
  try {
    reconcileService.unreconcile(reconcileRepo.find(reconcile.getId()));
    response.setReload(true);
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}
Program: 58757
Project: 58757
Buggy source:
@Override public void setLines(InvoicingProject invoicingProject,ProjectTask projectTask,int counter){
  if (counter > ProjectTaskService.MAX_LEVEL_OF_PROJECT) {
    return;
  }
  counter++;
  if (projectTask.getProjTaskInvTypeSelect() == ProjectTaskRepository.INVOICING_TYPE_FLAT_RATE || projectTask.getProjTaskInvTypeSelect() == ProjectTaskRepository.INVOICING_TYPE_TIME_BASED) {
    invoicingProject.getSaleOrderLineSet().addAll(Beans.get(SaleOrderLineRepository.class).all().filter("String_Node_Str",projectTask,invoicingProject.getDeadlineDate()).fetch());
    invoicingProject.getPurchaseOrderLineSet().addAll(Beans.get(PurchaseOrderLineRepository.class).all().filter("String_Node_Str",projectTask,invoicingProject.getDeadlineDate()).fetch());
    invoicingProject.getLogTimesSet().addAll(Beans.get(TimesheetLineRepository.class).all().filter("String_Node_Str",projectTask,invoicingProject.getDeadlineDate()).fetch());
    invoicingProject.getExpenseLineSet().addAll(Beans.get(ExpenseLineRepository.class).all().filter("String_Node_Str",projectTask,invoicingProject.getDeadlineDate()).fetch());
    invoicingProject.getElementsToInvoiceSet().addAll(Beans.get(ElementsToInvoiceRepository.class).all().filter("String_Node_Str",projectTask,invoicingProject.getDeadlineDate()).fetch());
    invoicingProject.getManufOrderSet().addAll(Beans.get(ManufOrderRepository.class).all().filter("String_Node_Str",projectTask,invoicingProject.getDeadlineDate()).fetch());
    if (projectTask.getProjTaskInvTypeSelect() == ProjectTaskRepository.INVOICING_TYPE_FLAT_RATE && !projectTask.getInvoiced())     invoicingProject.addProjectTaskSetItem(projectTask);
  }
  List<ProjectTask> projectTaskChildrenList=Beans.get(ProjectTaskRepository.class).all().filter("String_Node_Str",projectTask).fetch();
  for (  ProjectTask projectTaskChild : projectTaskChildrenList) {
    this.setLines(invoicingProject,projectTaskChild,counter);
  }
  return;
}

Fixed version (ground truth):
@Override public void setLines(InvoicingProject invoicingProject,ProjectTask projectTask,int counter){
  if (counter > ProjectTaskService.MAX_LEVEL_OF_PROJECT) {
    return;
  }
  counter++;
  this.fillLines(invoicingProject,projectTask);
  List<ProjectTask> projectTaskChildrenList=Beans.get(ProjectTaskRepository.class).all().filter("String_Node_Str",projectTask).fetch();
  for (  ProjectTask projectTaskChild : projectTaskChildrenList) {
    this.setLines(invoicingProject,projectTaskChild,counter);
  }
  return;
}
Program: 58758
Project: 58758
Buggy source:
public void setLines(InvoicingProject invoicingProject,ProjectTask projectTask,int counter){
  if (counter > ProjectTaskService.MAX_LEVEL_OF_PROJECT) {
    return;
  }
  counter++;
  if (projectTask.getProjTaskInvTypeSelect() == ProjectTaskRepository.INVOICING_TYPE_FLAT_RATE || projectTask.getProjTaskInvTypeSelect() == ProjectTaskRepository.INVOICING_TYPE_TIME_BASED) {
    invoicingProject.getSaleOrderLineSet().addAll(Beans.get(SaleOrderLineRepository.class).all().filter("String_Node_Str",projectTask,invoicingProject.getDeadlineDate()).fetch());
    invoicingProject.getPurchaseOrderLineSet().addAll(Beans.get(PurchaseOrderLineRepository.class).all().filter("String_Node_Str",projectTask,invoicingProject.getDeadlineDate()).fetch());
    invoicingProject.getLogTimesSet().addAll(Beans.get(TimesheetLineRepository.class).all().filter("String_Node_Str",projectTask,invoicingProject.getDeadlineDate()).fetch());
    invoicingProject.getExpenseLineSet().addAll(Beans.get(ExpenseLineRepository.class).all().filter("String_Node_Str",projectTask,invoicingProject.getDeadlineDate()).fetch());
    invoicingProject.getElementsToInvoiceSet().addAll(Beans.get(ElementsToInvoiceRepository.class).all().filter("String_Node_Str",projectTask,invoicingProject.getDeadlineDate()).fetch());
    if (projectTask.getProjTaskInvTypeSelect() == ProjectTaskRepository.INVOICING_TYPE_FLAT_RATE && !projectTask.getInvoiced())     invoicingProject.addProjectTaskSetItem(projectTask);
  }
  List<ProjectTask> projectTaskChildrenList=Beans.get(ProjectTaskRepository.class).all().filter("String_Node_Str",projectTask).fetch();
  for (  ProjectTask projectTaskChild : projectTaskChildrenList) {
    this.setLines(invoicingProject,projectTaskChild,counter);
  }
  return;
}

Fixed version (ground truth):
public void setLines(InvoicingProject invoicingProject,ProjectTask projectTask,int counter){
  if (counter > ProjectTaskService.MAX_LEVEL_OF_PROJECT) {
    return;
  }
  counter++;
  this.fillLines(invoicingProject,projectTask);
  List<ProjectTask> projectTaskChildrenList=Beans.get(ProjectTaskRepository.class).all().filter("String_Node_Str",projectTask).fetch();
  for (  ProjectTask projectTaskChild : projectTaskChildrenList) {
    this.setLines(invoicingProject,projectTaskChild,counter);
  }
  return;
}
Program: 58759
Project: 58759
Buggy source:
@Override protected void configure(){
  bind(ProductionOrderServiceImpl.class).to(ProductionOrderServiceBusinessImpl.class);
  bind(CostSheetServiceImpl.class).to(CostSheetServiceBusinessImpl.class);
  bind(ManufOrderServiceImpl.class).to(ManufOrderServiceBusinessImpl.class);
  bind(OperationOrderServiceImpl.class).to(OperationOrderServiceBusinessImpl.class);
  bind(ProductionOrderServiceImpl.class).to(ProductionOrderServiceBusinessImpl.class);
  bind(ProductionOrderWizardServiceImpl.class).to(ProductionOrderWizardServiceBusinessImpl.class);
  bind(ProductionOrderSaleOrderServiceImpl.class).to(ProductionOrderSaleOrderServiceBusinessImpl.class);
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(ProductionOrderServiceImpl.class).to(ProductionOrderServiceBusinessImpl.class);
  bind(CostSheetServiceImpl.class).to(CostSheetServiceBusinessImpl.class);
  bind(ManufOrderServiceImpl.class).to(ManufOrderServiceBusinessImpl.class);
  bind(OperationOrderServiceImpl.class).to(OperationOrderServiceBusinessImpl.class);
  bind(ProductionOrderServiceImpl.class).to(ProductionOrderServiceBusinessImpl.class);
  bind(ProductionOrderWizardServiceImpl.class).to(ProductionOrderWizardServiceBusinessImpl.class);
  bind(ProductionOrderSaleOrderServiceImpl.class).to(ProductionOrderSaleOrderServiceBusinessImpl.class);
  bind(InvoicingProjectService.class).to(InvoicingProjectServiceBusinessProdImpl.class);
}
Program: 58761
Project: 58761
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();
  Reconcile reconcile=invoicePayment.getReconcile();
  if (reconcile != null && reconcile.getStatusSelect() == ReconcileRepository.STATUS_CONFIRMED) {
    reconcileService.unreconcile(reconcile);
  }
  if (paymentMove != null) {
    moveCancelService.cancel(paymentMove);
  }
  invoicePayment.setStatusSelect(InvoicePaymentRepository.STATUS_CANCELED);
  invoiceService.updateAmountPaid(invoicePayment.getInvoice());
  invoicePaymentRepository.save(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();
  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.setMove(null);
    moveCancelService.cancel(paymentMove);
  }
  invoicePayment.setStatusSelect(InvoicePaymentRepository.STATUS_CANCELED);
  invoicePaymentRepository.save(invoicePayment);
  invoiceService.updateAmountPaid(invoicePayment.getInvoice());
}
Program: 58762
Project: 58762
Buggy source:
@Override public ProjectTask save(ProjectTask projectTask){
  projectTask.setFullName(projectTask.getCode() + "String_Node_Str" + projectTask.getName());
  if (projectTask.getChildProjectTaskList() != null && !projectTask.getChildProjectTaskList().isEmpty()) {
    for (    ProjectTask child : projectTask.getChildProjectTaskList()) {
      String code=(Strings.isNullOrEmpty(child.getCode())) ? "String_Node_Str" : child.getCode();
      String name=(Strings.isNullOrEmpty(child.getName())) ? "String_Node_Str" : child.getName();
      child.setFullName(code + "String_Node_Str" + name);
    }
  }
  return super.save(projectTask);
}

Fixed version (ground truth):
@Override public ProjectTask save(ProjectTask projectTask){
  String projectCode=(Strings.isNullOrEmpty(projectTask.getCode())) ? "String_Node_Str" : projectTask.getCode() + "String_Node_Str";
  projectTask.setFullName(projectCode + projectTask.getName());
  if (projectTask.getChildProjectTaskList() != null && !projectTask.getChildProjectTaskList().isEmpty()) {
    for (    ProjectTask child : projectTask.getChildProjectTaskList()) {
      String code=(Strings.isNullOrEmpty(child.getCode())) ? "String_Node_Str" : child.getCode() + "String_Node_Str";
      child.setFullName(code + child.getName());
    }
  }
  return super.save(projectTask);
}
Program: 58764
Project: 58764
Buggy source:
public void generateNewVersion(ActionRequest request,ActionResponse response){
  BillOfMaterial billOfMaterial=billOfMaterialRepo.find(request.getContext().asType(BillOfMaterial.class).getId());
  BillOfMaterial copy=billOfMaterialService.generateNewVersion(billOfMaterial);
  response.setView(ActionView.define("String_Node_Str").model(BillOfMaterial.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").context("String_Node_Str",String.valueOf(copy.getId())).map());
}

Fixed version (ground truth):
public void generateNewVersion(ActionRequest request,ActionResponse response){
  BillOfMaterial billOfMaterial=billOfMaterialRepo.find(request.getContext().asType(BillOfMaterial.class).getId());
  BillOfMaterial copy=billOfMaterialService.generateNewVersion(billOfMaterial);
  response.setView(ActionView.define("String_Node_Str").model(BillOfMaterial.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").domain("String_Node_Str").context("String_Node_Str",String.valueOf(copy.getId())).map());
}
Program: 58765
Project: 58765
Buggy source:
public void checkIbanValidity(ActionRequest request,ActionResponse response) throws AxelorException {
  List<BankDetails> bankDetailsList=request.getContext().asType(Partner.class).getBankDetailsList();
  List<String> ibanInError=Lists.newArrayList();
  for (  BankDetails bankDetails : bankDetailsList) {
    if (bankDetails.getIban() != null) {
      LOG.debug("String_Node_Str",bankDetails.getIban());
      if (!IBANCheckDigit.IBAN_CHECK_DIGIT.isValid(bankDetails.getIban())) {
        ibanInError.add(bankDetails.getIban());
      }
    }
  }
  if (!ibanInError.isEmpty()) {
    Function<String,String> addLi=new Function<String,String>(){
      @Override public String apply(      String s){
        return "String_Node_Str".concat(s).concat("String_Node_Str").toString();
      }
    }
;
    response.setAlert(String.format(IExceptionMessage.BANK_DETAILS_2,"String_Node_Str" + Joiner.on("String_Node_Str").join(Iterables.transform(ibanInError,addLi)) + "String_Node_Str"));
  }
}

Fixed version (ground truth):
public void checkIbanValidity(ActionRequest request,ActionResponse response) throws AxelorException {
  List<BankDetails> bankDetailsList=request.getContext().asType(Partner.class).getBankDetailsList();
  List<String> ibanInError=Lists.newArrayList();
  if (bankDetailsList != null && !bankDetailsList.isEmpty()) {
    for (    BankDetails bankDetails : bankDetailsList) {
      if (bankDetails.getIban() != null) {
        LOG.debug("String_Node_Str",bankDetails.getIban());
        if (!IBANCheckDigit.IBAN_CHECK_DIGIT.isValid(bankDetails.getIban())) {
          ibanInError.add(bankDetails.getIban());
        }
      }
    }
  }
  if (!ibanInError.isEmpty()) {
    Function<String,String> addLi=new Function<String,String>(){
      @Override public String apply(      String s){
        return "String_Node_Str".concat(s).concat("String_Node_Str").toString();
      }
    }
;
    response.setAlert(String.format(IExceptionMessage.BANK_DETAILS_2,"String_Node_Str" + Joiner.on("String_Node_Str").join(Iterables.transform(ibanInError,addLi)) + "String_Node_Str"));
  }
}
Program: 58766
Project: 58766
Buggy source:
public PurchaseOrderLine createPurchaseOrderLine(PurchaseOrder purchaseOrder,PurchaseOrderLine purchaseOrderLine) throws AxelorException {
  LOG.debug("String_Node_Str",new Object[]{purchaseOrderLine.getProductName()});
  return purchaseOrderLineService.createPurchaseOrderLine(purchaseOrder,purchaseOrderLine.getProduct(),purchaseOrderLine.getDescription(),purchaseOrderLine.getQty(),purchaseOrderLine.getUnit());
}

Fixed version (ground truth):
public PurchaseOrderLine createPurchaseOrderLine(PurchaseOrder purchaseOrder,PurchaseOrderLine purchaseOrderLine) throws AxelorException {
  LOG.debug("String_Node_Str",new Object[]{purchaseOrderLine.getProductName()});
  return purchaseOrderLineService.createPurchaseOrderLine(purchaseOrder,purchaseOrderLine.getProduct(),purchaseOrderLine.getProductName(),purchaseOrderLine.getDescription(),purchaseOrderLine.getQty(),purchaseOrderLine.getUnit());
}
Program: 58767
Project: 58767
Buggy source:
public ReportSettings addFormat(String format){
  this.format=format;
  return this;
}

Fixed version (ground truth):
public ReportSettings addFormat(String format){
  if (format != null) {
    this.format=format;
  }
  return this;
}
Program: 58770
Project: 58770
Buggy source:
@Override protected void process(){
  if (batch.getMailBatch().getCode() == MailBatchRepository.CODE_BATCH_EMAIL_TIME_SHEET) {
    if (batch.getMailBatch().getTemplate() != null)     this.generateEmailTemplate();
 else     this.generateEmail();
  }
 else   if (batch.getMailBatch().getCode() == MailBatchRepository.CODE_BATCH_EMAIL_ALL_TIME_SHEET) {
    if (batch.getMailBatch().getTemplate() != null)     this.generateAllEmailTemplate();
 else     this.generateAllEmail();
  }
}

Fixed version (ground truth):
@Override protected void process(){
  if (batch.getMailBatch().getCode().equals(MailBatchRepository.CODE_BATCH_EMAIL_TIME_SHEET)) {
    if (batch.getMailBatch().getTemplate() != null)     this.generateEmailTemplate();
 else     this.generateEmail();
  }
 else   if (batch.getMailBatch().getCode().equals(MailBatchRepository.CODE_BATCH_EMAIL_ALL_TIME_SHEET)) {
    if (batch.getMailBatch().getTemplate() != null)     this.generateAllEmailTemplate();
 else     this.generateAllEmail();
  }
}
Program: 58771
Project: 58771
Buggy source:
public void generateEmailTemplate(){
  Company company=batch.getMailBatch().getCompany();
  Template template=batch.getMailBatch().getTemplate();
  List<Timesheet> timesheetList=null;
  if (Beans.get(CompanyRepository.class).all().fetch().size() > 1) {
    timesheetList=Beans.get(TimesheetRepository.class).all().filter("String_Node_Str",company.getId()).fetch();
  }
 else {
    timesheetList=Beans.get(TimesheetRepository.class).all().filter("String_Node_Str").fetch();
  }
  String model=template.getMetaModel().getFullName();
  String tag=template.getMetaModel().getName();
  for (  Timesheet timesheet : timesheetList) {
    Message message=new Message();
    try {
      message=templateMessageService.generateMessage(timesheet.getId(),model,tag,template);
      message=messageServiceImpl.sendByEmail(message);
      incrementDone();
    }
 catch (    Exception e) {
      incrementAnomaly();
      TraceBackService.trace(new Exception(e),IException.REMINDER,batch.getId());
    }
  }
}

Fixed version (ground truth):
public void generateEmailTemplate(){
  Company company=batch.getMailBatch().getCompany();
  Template template=batch.getMailBatch().getTemplate();
  List<Timesheet> timesheetList=null;
  if (Beans.get(CompanyRepository.class).all().fetch().size() > 1) {
    timesheetList=Beans.get(TimesheetRepository.class).all().filter("String_Node_Str",company.getId()).fetch();
  }
 else {
    timesheetList=Beans.get(TimesheetRepository.class).all().filter("String_Node_Str").fetch();
  }
  String model=template.getMetaModel().getFullName();
  String tag=template.getMetaModel().getName();
  for (  Timesheet timesheet : timesheetList) {
    Message message=new Message();
    try {
      message=templateMessageService.generateMessage(timesheet.getUser().getEmployee().getId(),model,tag,template);
      message=messageServiceImpl.sendByEmail(message);
      incrementDone();
    }
 catch (    Exception e) {
      incrementAnomaly();
      TraceBackService.trace(new Exception(e),IException.REMINDER,batch.getId());
    }
  }
}
Program: 58772
Project: 58772
Buggy source:
@Override @Transactional(rollbackOn={AxelorException.class,Exception.class}) public Message sendMessage(Message message){
  super.sendMessage(message);
  if (!message.getStatusSelect().equals(MessageRepository.STATUS_SENT)) {
    return message;
  }
  message.setSentDateT(generalService.getTodayDateTime().toLocalDateTime());
  return messageRepo.save(message);
}

Fixed version (ground truth):
@Override @Transactional(rollbackOn={AxelorException.class,Exception.class}) public Message sendMessage(Message message) throws AxelorException {
  super.sendMessage(message);
  if (!message.getStatusSelect().equals(MessageRepository.STATUS_SENT)) {
    return message;
  }
  message.setSentDateT(generalService.getTodayDateTime().toLocalDateTime());
  return messageRepo.save(message);
}
Program: 58773
Project: 58773
Buggy source:
@Transactional(rollbackOn={MessagingException.class,IOException.class,Exception.class}) public Message sendByEmail(Message message) throws MessagingException, IOException ;

Fixed version (ground truth):
@Transactional(rollbackOn={MessagingException.class,IOException.class,Exception.class}) public Message sendByEmail(Message message) throws MessagingException, IOException, AxelorException ;
Program: 58774
Project: 58774
Buggy source:
public Message sendMessage(Message message);

Fixed version (ground truth):
public Message sendMessage(Message message) throws AxelorException ;
Program: 58777
Project: 58777
Buggy source:
public Message sendMessage(Message message){
  try {
    if (message.getMediaTypeSelect() == MessageRepository.MEDIA_TYPE_MAIL) {
      return sendByMail(message);
    }
 else     if (message.getMediaTypeSelect() == MessageRepository.MEDIA_TYPE_EMAIL) {
      return sendByEmail(message);
    }
 else     if (message.getMediaTypeSelect() == MessageRepository.MEDIA_TYPE_CHAT) {
      return sendToUser(message);
    }
  }
 catch (  MessagingException|IOException e) {
    TraceBackService.trace(e);
  }
  return message;
}

Fixed version (ground truth):
public Message sendMessage(Message message) throws AxelorException {
  try {
    if (message.getMediaTypeSelect() == MessageRepository.MEDIA_TYPE_MAIL) {
      return sendByMail(message);
    }
 else     if (message.getMediaTypeSelect() == MessageRepository.MEDIA_TYPE_EMAIL) {
      return sendByEmail(message);
    }
 else     if (message.getMediaTypeSelect() == MessageRepository.MEDIA_TYPE_CHAT) {
      return sendToUser(message);
    }
  }
 catch (  MessagingException|IOException e) {
    TraceBackService.trace(e);
  }
  return message;
}
Program: 58778
Project: 58778
Buggy source:
public void sendByEmail(ActionRequest request,ActionResponse response){
  Message message=request.getContext().asType(Message.class);
  try {
    message=messageService.sendByEmail(messageRepo.find(message.getId()));
    response.setReload(true);
    if (message.getStatusSelect() == MessageRepository.STATUS_SENT) {
      if (message.getSentByEmail()) {
        response.setFlash(I18n.get(IExceptionMessage.MESSAGE_4));
      }
 else {
        response.setFlash(I18n.get(IExceptionMessage.MESSAGE_5));
      }
    }
 else {
      response.setFlash(I18n.get(IExceptionMessage.MESSAGE_6));
    }
  }
 catch (  MessagingException|IOException e) {
    TraceBackService.trace(e);
  }
}

Fixed version (ground truth):
public void sendByEmail(ActionRequest request,ActionResponse response) throws AxelorException {
  Message message=request.getContext().asType(Message.class);
  try {
    message=messageService.sendByEmail(messageRepo.find(message.getId()));
    response.setReload(true);
    if (message.getStatusSelect() == MessageRepository.STATUS_SENT) {
      if (message.getSentByEmail()) {
        response.setFlash(I18n.get(IExceptionMessage.MESSAGE_4));
      }
 else {
        response.setFlash(I18n.get(IExceptionMessage.MESSAGE_5));
      }
    }
 else {
      response.setFlash(I18n.get(IExceptionMessage.MESSAGE_6));
    }
  }
 catch (  MessagingException|IOException e) {
    TraceBackService.trace(e);
  }
}
Program: 58781
Project: 58781
Buggy source:
/** 
 * Créer une exception avec son message, sa cause et son type.
 * @param message Le message de l'exception
 * @param cause La cause de l'exception 
 * @param category <ul> <li>1: Champ manquant</li> <li>2: Clef non unique</li> <li>3: Aucune valeur retournée</li> <li>4: Problème de configuration</li> <li>5: Incohérence</li> </ul>
 * @see Throwable
 */
public AxelorException(String message,Throwable cause,int category,Object... messageArgs){
  super(String.format(message,messageArgs),cause);
  this.category=category;
}

Fixed version (ground truth):
/** 
 * Create an exception with his message, his cause and his type.	  
 * @param message The exception message
 * @param cause The exception cause
 * @param category The exception category <ul> <li>1: Missing field</li> <li>2: No unique key</li> <li>3: No value</li> <li>4: configuration error</li> <li>5: Inconsistency</li> </ul>
 * @see Throwable
 */
public AxelorException(String message,Throwable cause,int category,Object... messageArgs){
  super(String.format(message,messageArgs),cause);
  this.category=category;
}
Program: 58782
Project: 58782
Buggy source:
/** 
 * Récupérer la catégorie de l'exception
 * @return Un entier correspondant à l'une des catégories suivantes : <ul> <li>1: Champ manquant</li> <li>2: Clef non unique</li> <li>3: Aucune valeur retournée</li> <li>4: Problème de configuration</li> <li>5: Incohérence</li> </ul>
 */
public int getcategory(){
  return this.category;
}

Fixed version (ground truth):
/** 
 * Get the category of exception
 * @return <ul> <li>1: Missing field</li> <li>2: No unique key</li> <li>3: No value</li> <li>4: configuration error</li> <li>5: Inconsistency</li> </ul>
 */
public int getcategory(){
  return this.category;
}
Program: 58783
Project: 58783
Buggy source:
public BigDecimal convertUnitPrice(PurchaseOrderLine purchaseOrderLine,PurchaseOrder purchaseOrder);

Fixed version (ground truth):
public BigDecimal convertUnitPrice(Product product,TaxLine taxLine,BigDecimal price,PurchaseOrder purchaseOrder);
Program: 58784
Project: 58784
Buggy source:
public BigDecimal getUnitPrice(PurchaseOrder purchaseOrder,PurchaseOrderLine purchaseOrderLine) throws AxelorException ;

Fixed version (ground truth):
public BigDecimal getUnitPrice(PurchaseOrder purchaseOrder,PurchaseOrderLine purchaseOrderLine,TaxLine taxLine) throws AxelorException ;
Program: 58785
Project: 58785
Buggy source:
@Override public BigDecimal getMinSalePrice(PurchaseOrder purchaseOrder,PurchaseOrderLine purchaseOrderLine) throws AxelorException {
  Product product=purchaseOrderLine.getProduct();
  return currencyService.getAmountCurrencyConverted(product.getSaleCurrency(),purchaseOrder.getCurrency(),product.getSalePrice(),purchaseOrder.getOrderDate()).setScale(generalService.getNbDecimalDigitForUnitPrice(),RoundingMode.HALF_UP);
}

Fixed version (ground truth):
@Override public BigDecimal getMinSalePrice(PurchaseOrder purchaseOrder,PurchaseOrderLine purchaseOrderLine) throws AxelorException {
  Product product=purchaseOrderLine.getProduct();
  TaxLine saleTaxLine=accountManagementService.getTaxLine(purchaseOrder.getOrderDate(),purchaseOrderLine.getProduct(),purchaseOrder.getCompany(),purchaseOrder.getSupplierPartner().getFiscalPosition(),false);
  BigDecimal price=this.convertUnitPrice(product,saleTaxLine,product.getSalePrice(),purchaseOrder);
  return currencyService.getAmountCurrencyConverted(product.getSaleCurrency(),purchaseOrder.getCurrency(),price,purchaseOrder.getOrderDate()).setScale(generalService.getNbDecimalDigitForUnitPrice(),RoundingMode.HALF_UP);
}
Program: 58786
Project: 58786
Buggy source:
@Override public BigDecimal getSalePrice(PurchaseOrder purchaseOrder,Product product,BigDecimal price) throws AxelorException {
  return currencyService.getAmountCurrencyConverted(product.getSaleCurrency(),purchaseOrder.getCurrency(),price.multiply(product.getManagPriceCoef()),purchaseOrder.getOrderDate()).setScale(generalService.getNbDecimalDigitForUnitPrice(),RoundingMode.HALF_UP);
}

Fixed version (ground truth):
@Override public BigDecimal getSalePrice(PurchaseOrder purchaseOrder,Product product,BigDecimal price) throws AxelorException {
  TaxLine saleTaxLine=accountManagementService.getTaxLine(purchaseOrder.getOrderDate(),product,purchaseOrder.getCompany(),purchaseOrder.getSupplierPartner().getFiscalPosition(),false);
  price=this.convertUnitPrice(product,saleTaxLine,price,purchaseOrder);
  price=price.multiply(product.getManagPriceCoef());
  return currencyService.getAmountCurrencyConverted(product.getSaleCurrency(),purchaseOrder.getCurrency(),price,purchaseOrder.getOrderDate()).setScale(generalService.getNbDecimalDigitForUnitPrice(),RoundingMode.HALF_UP);
}
Program: 58787
Project: 58787
Buggy source:
@Override public BigDecimal convertUnitPrice(PurchaseOrderLine purchaseOrderLine,PurchaseOrder purchaseOrder){
  BigDecimal price=purchaseOrderLine.getPrice();
  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;
}

Fixed version (ground truth):
@Override public BigDecimal convertUnitPrice(Product product,TaxLine taxLine,BigDecimal price,PurchaseOrder purchaseOrder){
  if (taxLine == null) {
    return price;
  }
  if (product.getInAti() && !purchaseOrder.getInAti()) {
    price=price.divide(taxLine.getValue().add(BigDecimal.ONE),2,BigDecimal.ROUND_HALF_UP);
  }
 else   if (!product.getInAti() && purchaseOrder.getInAti()) {
    price=price.add(price.multiply(taxLine.getValue()));
  }
  return price;
}
Program: 58788
Project: 58788
Buggy source:
@Override public BigDecimal getUnitPrice(PurchaseOrder purchaseOrder,PurchaseOrderLine purchaseOrderLine) throws AxelorException {
  Product product=purchaseOrderLine.getProduct();
  return currencyService.getAmountCurrencyConverted(product.getPurchaseCurrency(),purchaseOrder.getCurrency(),product.getPurchasePrice(),purchaseOrder.getOrderDate()).setScale(generalService.getNbDecimalDigitForUnitPrice(),RoundingMode.HALF_UP);
}

Fixed version (ground truth):
@Override public BigDecimal getUnitPrice(PurchaseOrder purchaseOrder,PurchaseOrderLine purchaseOrderLine,TaxLine taxLine) throws AxelorException {
  Product product=purchaseOrderLine.getProduct();
  BigDecimal price=this.convertUnitPrice(product,taxLine,product.getPurchasePrice(),purchaseOrder);
  return currencyService.getAmountCurrencyConverted(product.getPurchaseCurrency(),purchaseOrder.getCurrency(),price,purchaseOrder.getOrderDate()).setScale(generalService.getNbDecimalDigitForUnitPrice(),RoundingMode.HALF_UP);
}
Program: 58792
Project: 58792
Buggy source:
@Inject public MoveService(GeneralService generalService,MoveLineService moveLineService,MoveCreateService moveCreateService,MoveValidateService moveValidateService,MoveToolService moveToolService,ReconcileService reconcileService,MoveDueService moveDueService,MoveExcessPaymentService moveExcessPaymentService,MoveRepository moveRepository,AccountConfigService accountConfigService){
  this.moveLineService=moveLineService;
  this.moveCreateService=moveCreateService;
  this.moveValidateService=moveValidateService;
  this.moveToolService=moveToolService;
  this.reconcileService=reconcileService;
  this.moveDueService=moveDueService;
  this.moveExcessPaymentService=moveExcessPaymentService;
  this.moveRepository=moveRepository;
  this.accountConfigService=accountConfigService;
  today=generalService.getTodayDate();
}

Fixed version (ground truth):
@Inject public MoveService(GeneralService generalService,MoveLineService moveLineService,MoveCreateService moveCreateService,MoveValidateService moveValidateService,MoveToolService moveToolService,ReconcileService reconcileService,MoveDueService moveDueService,PaymentService paymentService,MoveExcessPaymentService moveExcessPaymentService,MoveRepository moveRepository,AccountConfigService accountConfigService){
  this.moveLineService=moveLineService;
  this.moveCreateService=moveCreateService;
  this.moveValidateService=moveValidateService;
  this.moveToolService=moveToolService;
  this.reconcileService=reconcileService;
  this.moveDueService=moveDueService;
  this.paymentService=paymentService;
  this.moveExcessPaymentService=moveExcessPaymentService;
  this.moveRepository=moveRepository;
  this.accountConfigService=accountConfigService;
  today=generalService.getTodayDate();
}
Program: 58793
Project: 58793
Buggy source:
/** 
 * Fonction appeler par le bouton générer un avoir.
 * @param request
 * @param response
 */
public void createRefund(ActionRequest request,ActionResponse response){
  Invoice invoice=request.getContext().asType(Invoice.class);
  try {
    invoice=invoiceRepo.find(invoice.getId());
    Invoice refund=invoiceService.createRefund(invoice);
    response.setReload(true);
    response.setNotify(I18n.get(IExceptionMessage.INVOICE_2));
    response.setView(ActionView.define(String.format(I18n.get(IExceptionMessage.INVOICE_4),invoice.getInvoiceId())).model(Invoice.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").context("String_Node_Str",refund.getId().toString()).domain("String_Node_Str" + invoice.getId()).map());
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
/** 
 * Fonction appeler par le bouton générer un avoir.
 * @param request
 * @param response
 */
public void createRefund(ActionRequest request,ActionResponse response){
  Invoice invoice=request.getContext().asType(Invoice.class);
  try {
    invoice=invoiceRepo.find(invoice.getId());
    Invoice refund=invoiceService.createRefund(invoice);
    response.setReload(true);
    response.setNotify(I18n.get(IExceptionMessage.INVOICE_2));
    response.setView(ActionView.define(String.format(I18n.get(IExceptionMessage.INVOICE_4),invoice.getInvoiceId())).model(Invoice.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").param("String_Node_Str","String_Node_Str").context("String_Node_Str",refund.getId().toString()).domain("String_Node_Str" + invoice.getId()).map());
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}
Program: 58795
Project: 58795
Buggy source:
/** 
 * @param queryFilter
 * @return
 */
public BigDecimal getDebitBalance(){
  Query q=JPA.em().createQuery("String_Node_Str" + query,BigDecimal.class);
  BigDecimal result=(BigDecimal)q.getSingleResult();
  log.debug("String_Node_Str",result);
  int i=1;
  for (  Object param : params.toArray()) {
    q.setParameter(i++,param);
  }
  if (result != null) {
    return result;
  }
 else {
    return BigDecimal.ZERO;
  }
}

Fixed version (ground truth):
/** 
 * @param queryFilter
 * @return
 */
public BigDecimal getDebitBalance(){
  Query q=JPA.em().createQuery("String_Node_Str" + query,BigDecimal.class);
  int i=1;
  for (  Object param : params.toArray()) {
    q.setParameter(i++,param);
  }
  BigDecimal result=(BigDecimal)q.getSingleResult();
  log.debug("String_Node_Str",result);
  if (result != null) {
    return result;
  }
 else {
    return BigDecimal.ZERO;
  }
}
Program: 58796
Project: 58796
Buggy source:
public BigDecimal getDebitBalanceType4(){
  Query q=JPA.em().createQuery("String_Node_Str" + query,BigDecimal.class);
  BigDecimal result=(BigDecimal)q.getSingleResult();
  log.debug("String_Node_Str",result);
  int i=1;
  for (  Object param : params.toArray()) {
    q.setParameter(i++,param);
  }
  if (result != null) {
    return result;
  }
 else {
    return BigDecimal.ZERO;
  }
}

Fixed version (ground truth):
public BigDecimal getDebitBalanceType4(){
  Query q=JPA.em().createQuery("String_Node_Str" + query,BigDecimal.class);
  int i=1;
  for (  Object param : params.toArray()) {
    q.setParameter(i++,param);
  }
  BigDecimal result=(BigDecimal)q.getSingleResult();
  log.debug("String_Node_Str",result);
  if (result != null) {
    return result;
  }
 else {
    return BigDecimal.ZERO;
  }
}
Program: 58799
Project: 58799
Buggy source:
/** 
 * @param request
 * @param response
 */
public void searchMoveLine(ActionRequest request,ActionResponse response){
  MoveLineReport moveLineReport=request.getContext().asType(MoveLineReport.class);
  try {
    moveLineReport=moveLineReportRepo.find(moveLineReport.getId());
    moveLineReportService.buildQuery(moveLineReport);
    BigDecimal debitBalance=moveLineReportService.getDebitBalance();
    BigDecimal creditBalance=moveLineReportService.getCreditBalance();
    if (moveLineReport.getRef() == null) {
      response.setValue("String_Node_Str",moveLineReportService.getSequence(moveLineReport));
    }
    response.setValue("String_Node_Str",debitBalance);
    response.setValue("String_Node_Str",creditBalance);
    response.setValue("String_Node_Str",debitBalance.subtract(creditBalance));
    Map<String,Object> view=Maps.newHashMap();
    view.put("String_Node_Str",I18n.get(IExceptionMessage.MOVE_LINE_REPORT_3));
    view.put("String_Node_Str",MoveLine.class.getName());
    response.setView(view);
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
/** 
 * @param request
 * @param response
 */
public void searchMoveLine(ActionRequest request,ActionResponse response){
  MoveLineReport moveLineReport=request.getContext().asType(MoveLineReport.class);
  try {
    moveLineReport=moveLineReportRepo.find(moveLineReport.getId());
    moveLineReportService.getMoveLineList(moveLineReport);
    BigDecimal debitBalance=moveLineReportService.getDebitBalance();
    BigDecimal creditBalance=moveLineReportService.getCreditBalance();
    if (moveLineReport.getRef() == null) {
      response.setValue("String_Node_Str",moveLineReportService.getSequence(moveLineReport));
    }
    response.setValue("String_Node_Str",debitBalance);
    response.setValue("String_Node_Str",creditBalance);
    response.setValue("String_Node_Str",debitBalance.subtract(creditBalance));
    Map<String,Object> view=Maps.newHashMap();
    view.put("String_Node_Str",I18n.get(IExceptionMessage.MOVE_LINE_REPORT_3));
    view.put("String_Node_Str",MoveLine.class.getName());
    response.setView(view);
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}