nus-yam/ex-repair huggingface dataset:
Program: 58949
Project: 58949
Buggy source:
public Message sendMessage(Message message){
  try {
    if (message.getMediaTypeSelect() == MEDIA_TYPE_MAIL) {
      return sendByMail(message);
    }
 else     if (message.getMediaTypeSelect() == MEDIA_TYPE_EMAIL) {
      return sendByEmail(message);
    }
 else     if (message.getMediaTypeSelect() == MEDIA_TYPE_CHAT) {
      return sendToUser(message);
    }
  }
 catch (  MessagingException|IOException e) {
    LOG.error(e.getMessage());
  }
  return message;
}

Fixed version (ground truth):
public Message sendMessage(Message message){
  try {
    if (message.getMediaTypeSelect() == MEDIA_TYPE_MAIL) {
      return sendByMail(message);
    }
 else     if (message.getMediaTypeSelect() == MEDIA_TYPE_EMAIL) {
      return sendByEmail(message);
    }
 else     if (message.getMediaTypeSelect() == MEDIA_TYPE_CHAT) {
      return sendToUser(message);
    }
  }
 catch (  MessagingException|IOException e) {
    TraceBackService.trace(e);
  }
  return message;
}
Program: 58950
Project: 58950
Buggy source:
@Transactional(rollbackOn=Exception.class) public Message sendByMail(Message message){
  LOG.debug("String_Node_Str");
  message.setStatusSelect(MessageRepository.STATUS_SENT);
  message.setSentByEmail(false);
  message.setSentDateT(LocalDateTime.now());
  return save(message);
}

Fixed version (ground truth):
@Transactional(rollbackOn=Exception.class) public Message sendByMail(Message message){
  log.debug("String_Node_Str");
  message.setStatusSelect(MessageRepository.STATUS_SENT);
  message.setSentByEmail(false);
  message.setSentDateT(LocalDateTime.now());
  return save(message);
}
Program: 58951
Project: 58951
Buggy source:
public Set<MetaFile> getMetaFiles(Template template) throws AxelorException, IOException {
  List<MetaAttachment> metaAttachments=Query.of(MetaAttachment.class).filter("String_Node_Str",template.getId(),Template.class.getName()).fetch();
  Set<MetaFile> metaFiles=Sets.newHashSet();
  for (  MetaAttachment metaAttachment : metaAttachments) {
    metaFiles.add(metaAttachment.getMetaFile());
  }
  return metaFiles;
}

Fixed version (ground truth):
public Set<MetaFile> getMetaFiles(Template template) throws AxelorException, IOException {
  List<MetaAttachment> metaAttachments=Query.of(MetaAttachment.class).filter("String_Node_Str",template.getId(),Template.class.getName()).fetch();
  Set<MetaFile> metaFiles=Sets.newHashSet();
  for (  MetaAttachment metaAttachment : metaAttachments) {
    metaFiles.add(metaAttachment.getMetaFile());
  }
  log.debug("String_Node_Str",metaFiles);
  return metaFiles;
}
Program: 58952
Project: 58952
Buggy source:
public Set<MetaFile> getMetaFiles(Template template) throws AxelorException, IOException {
  List<MetaAttachment> metaAttachments=Beans.get(MetaAttachmentRepository.class).all().filter("String_Node_Str",template.getId(),Template.class.getName()).fetch();
  Set<MetaFile> metaFiles=Sets.newHashSet();
  for (  MetaAttachment metaAttachment : metaAttachments) {
    metaFiles.add(metaAttachment.getMetaFile());
  }
  return metaFiles;
}

Fixed version (ground truth):
public Set<MetaFile> getMetaFiles(Template template) throws AxelorException, IOException {
  List<MetaAttachment> metaAttachments=Query.of(MetaAttachment.class).filter("String_Node_Str",template.getId(),Template.class.getName()).fetch();
  Set<MetaFile> metaFiles=Sets.newHashSet();
  for (  MetaAttachment metaAttachment : metaAttachments) {
    metaFiles.add(metaAttachment.getMetaFile());
  }
  return metaFiles;
}
Program: 58954
Project: 58954
Buggy source:
protected List<EmailAddress> getEmailAddresses(String recipients){
  List<EmailAddress> emailAddressList=Lists.newArrayList();
  if (recipients != null && !recipients.isEmpty()) {
    String[] toTab=recipients.split("String_Node_Str");
    for (    String s : toTab) {
      emailAddressList.add(this.getEmailAddress(s));
    }
  }
  return emailAddressList;
}

Fixed version (ground truth):
protected List<EmailAddress> getEmailAddresses(String recipients){
  List<EmailAddress> emailAddressList=Lists.newArrayList();
  if (Strings.isNullOrEmpty(recipients)) {
    return emailAddressList;
  }
  for (  String recipient : recipients.split(RECIPIENT_SEPARATOR)) {
    emailAddressList.add(getEmailAddress(recipient));
  }
  return emailAddressList;
}
Program: 58955
Project: 58955
Buggy source:
@SuppressWarnings("String_Node_Str") public TemplateMaker initMaker(long objectId,String model,String tag) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
  this.maker=new TemplateMaker(Locale.FRENCH,'$','$');
  Class<? extends Model> myClass=(Class<? extends Model>)Class.forName(model);
  this.maker.setContext(JPA.find(myClass.newInstance().getClass(),objectId),tag);
  return this.maker;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public TemplateMaker initMaker(long objectId,String model,String tag) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
  this.maker=new TemplateMaker(Locale.FRENCH,TEMPLATE_DELIMITER,TEMPLATE_DELIMITER);
  Class<? extends Model> myClass=(Class<? extends Model>)Class.forName(model);
  maker.setContext(JPA.find(myClass,objectId),tag);
  return maker;
}
Program: 58956
Project: 58956
Buggy source:
public void callMessageWizard(ActionRequest request,ActionResponse response){
  Model context=request.getContext().asType(Model.class);
  String model=request.getModel();
  LOG.debug("String_Node_Str",model);
  String[] decomposeModel=model.split("String_Node_Str");
  String simpleModel=decomposeModel[decomposeModel.length - 1];
  Query<? extends Template> templateQuery=templateRepo.all().filter("String_Node_Str",model);
  try {
    long templateNumber=templateQuery.count();
    LOG.debug("String_Node_Str",templateNumber);
    if (templateNumber == 0) {
      response.setFlash(I18n.get(IExceptionMessage.MESSAGE_1));
    }
 else     if (templateNumber > 1 || templateNumber == 0) {
      response.setView(ActionView.define(I18n.get(IExceptionMessage.MESSAGE_2)).model(Wizard.class.getName()).add("String_Node_Str","String_Node_Str").context("String_Node_Str",context.toString()).context("String_Node_Str",model).context("String_Node_Str",simpleModel).map());
    }
 else {
      response.setView(generateMessage(context.getId(),model,simpleModel,templateQuery.fetchOne()));
    }
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
public void callMessageWizard(ActionRequest request,ActionResponse response){
  Model context=request.getContext().asType(Model.class);
  String model=request.getModel();
  LOG.debug("String_Node_Str",model);
  String[] decomposeModel=model.split("String_Node_Str");
  String simpleModel=decomposeModel[decomposeModel.length - 1];
  Query<? extends Template> templateQuery=templateRepo.all().filter("String_Node_Str",model);
  try {
    long templateNumber=templateQuery.count();
    LOG.debug("String_Node_Str",templateNumber);
    if (templateNumber == 0) {
      response.setFlash(I18n.get(IExceptionMessage.MESSAGE_1));
    }
 else     if (templateNumber > 1 || templateNumber == 0) {
      response.setView(ActionView.define(I18n.get(IExceptionMessage.MESSAGE_2)).model(Wizard.class.getName()).add("String_Node_Str","String_Node_Str").context("String_Node_Str",context.getId().toString()).context("String_Node_Str",model).context("String_Node_Str",simpleModel).map());
    }
 else {
      response.setView(generateMessage(context.getId(),model,simpleModel,templateQuery.fetchOne()));
    }
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}
Program: 58957
Project: 58957
Buggy source:
public TaxLine getTaxLine(Invoice invoice,InvoiceLine invoiceLine,boolean isPurchase) throws AxelorException {
  return accountManagementService.getTaxLine(invoice.getInvoiceDate(),invoiceLine.getProduct(),invoice.getCompany(),invoice.getPartner().getFiscalPosition(),isPurchase);
}

Fixed version (ground truth):
public TaxLine getTaxLine(Invoice invoice,InvoiceLine invoiceLine,boolean isPurchase) throws AxelorException {
  return accountManagementService.getTaxLine(GeneralService.getTodayDate(),invoiceLine.getProduct(),invoice.getCompany(),invoice.getPartner().getFiscalPosition(),isPurchase);
}
Program: 58959
Project: 58959
Buggy source:
@Override public void process() throws AxelorException {
  Preconditions.checkNotNull(invoice.getPartner());
  setDueDate();
  setInvoiceId();
  updatePaymentSchedule();
  setMove();
  setStatus();
}

Fixed version (ground truth):
@Override public void process() throws AxelorException {
  Preconditions.checkNotNull(invoice.getPartner());
  setDate();
  setInvoiceId();
  updatePaymentSchedule();
  setMove();
  setStatus();
}
Program: 58961
Project: 58961
Buggy source:
public void resetProductInformation(ActionResponse response){
  response.setValue("String_Node_Str",null);
  response.setValue("String_Node_Str",null);
  response.setValue("String_Node_Str",null);
  response.setValue("String_Node_Str",null);
  response.setValue("String_Node_Str",null);
}

Fixed version (ground truth):
public void resetProductInformation(ActionResponse response){
  response.setValue("String_Node_Str",null);
  response.setValue("String_Node_Str",null);
  response.setValue("String_Node_Str",null);
  response.setValue("String_Node_Str",null);
  response.setValue("String_Node_Str",null);
  response.setValue("String_Node_Str",null);
  response.setValue("String_Node_Str",null);
}
Program: 58962
Project: 58962
Buggy source:
@Override protected void configure(){
  bind(MinStockRulesService.class).to(MinStockRulesServiceImpl.class);
  bind(MinStockRulesServiceImpl.class).to(MinStockRulesServiceSupplychainImpl.class);
  bind(StockMoveService.class).to(StockMoveServiceImpl.class);
  bind(PurchaseOrderServiceImpl.class).to(PurchaseOrderServiceSupplychainImpl.class);
  bind(PurchaseOrderLineService.class).to(PurchaseOrderLineServiceImpl.class);
  bind(LocationLineService.class).to(LocationLineServiceImpl.class);
  bind(SaleOrderServiceStockImpl.class);
  bind(SaleOrderServiceImpl.class).to(SaleOrderServiceSupplychainImpl.class);
  bind(PurchaseOrderInvoiceService.class).to(PurchaseOrderInvoiceServiceImpl.class);
  bind(SaleOrderInvoiceService.class).to(SaleOrderInvoiceServiceImpl.class);
  bind(SaleOrderPurchaseService.class).to(SaleOrderPurchaseServiceImpl.class);
  bind(StockMoveLineService.class).to(StockMoveLineServiceImpl.class);
  bind(StockMoveInvoiceService.class).to(StockMoveInvoiceServiceImpl.class);
  bind(SaleOrderManagementRepository.class).to(SaleOrderSupplychainRepository.class);
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(MinStockRulesService.class).to(MinStockRulesServiceImpl.class);
  bind(MinStockRulesServiceImpl.class).to(MinStockRulesServiceSupplychainImpl.class);
  bind(StockMoveService.class).to(StockMoveServiceImpl.class);
  bind(PurchaseOrderServiceImpl.class).to(PurchaseOrderServiceSupplychainImpl.class);
  bind(PurchaseOrderLineService.class).to(PurchaseOrderLineServiceImpl.class);
  bind(LocationLineService.class).to(LocationLineServiceImpl.class);
  bind(SaleOrderServiceImpl.class).to(SaleOrderServiceSupplychainImpl.class);
  bind(PurchaseOrderInvoiceService.class).to(PurchaseOrderInvoiceServiceImpl.class);
  bind(SaleOrderInvoiceService.class).to(SaleOrderInvoiceServiceImpl.class);
  bind(SaleOrderPurchaseService.class).to(SaleOrderPurchaseServiceImpl.class);
  bind(StockMoveLineService.class).to(StockMoveLineServiceImpl.class);
  bind(StockMoveInvoiceService.class).to(StockMoveInvoiceServiceImpl.class);
  bind(SaleOrderManagementRepository.class).to(SaleOrderSupplychainRepository.class);
}
Program: 58963
Project: 58963
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);
  InvoiceService is=Beans.get(InvoiceService.class);
  try {
    invoice=is.find(invoice.getId());
    Invoice refund=is.createRefund(invoice);
    response.setReload(true);
    response.setFlash(I18n.get(IExceptionMessage.INVOICE_2));
    response.setView(ActionView.define(String.format(I18n.get(IExceptionMessage.INVOICE_4),invoice.getInvoiceId())).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);
  InvoiceService is=Beans.get(InvoiceService.class);
  try {
    invoice=is.find(invoice.getId());
    Invoice refund=is.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);
  }
}
Program: 58964
Project: 58964
Buggy source:
public void createInvoice(ActionRequest request,ActionResponse response){
  Project project=request.getContext().asType(Project.class);
  if (project != null) {
    try {
      Invoice invoice=projectInvoiceService.generateInvoice(project);
      if (invoice != null) {
        response.setReload(true);
        response.setFlash(I18n.get(com.axelor.apps.supplychain.exception.IExceptionMessage.PO_INVOICE_2));
      }
 else {
        response.setFlash(I18n.get(IExceptionMessage.PROJECT_INVOICE_1));
      }
    }
 catch (    Exception e) {
      TraceBackService.trace(response,e);
    }
  }
}

Fixed version (ground truth):
public void createInvoice(ActionRequest request,ActionResponse response){
  Project project=request.getContext().asType(Project.class);
  if (project != null) {
    try {
      Invoice invoice=projectInvoiceService.generateInvoice(Beans.get(ProjectRepository.class).find(project.getId()));
      if (invoice != null) {
        response.setReload(true);
        response.setFlash(I18n.get(com.axelor.apps.supplychain.exception.IExceptionMessage.PO_INVOICE_2));
      }
 else {
        response.setFlash(I18n.get(IExceptionMessage.PROJECT_INVOICE_1));
      }
    }
 catch (    Exception e) {
      TraceBackService.trace(response,e);
    }
  }
}
Program: 58965
Project: 58965
Buggy source:
private boolean reset(Sequence sequence){
  if (this.refDate == null) {
    return false;
  }
  if (!sequence.getYearlyResetOk() && !sequence.getMonthlyResetOk()) {
    return false;
  }
  if (!this.refDate.isAfter(sequence.getResetDate())) {
    return false;
  }
  if (sequence.getYearlyResetOk() && !this.refDate.equals(this.refDate.monthOfYear().withMinimumValue().dayOfMonth().withMinimumValue())) {
    return false;
  }
  if (sequence.getMonthlyResetOk() && !this.refDate.equals(this.refDate.dayOfMonth().withMinimumValue())) {
    return false;
  }
  sequence.setResetDate(refDate);
  sequence.setNextNum(1);
  return true;
}

Fixed version (ground truth):
private boolean reset(Sequence sequence){
  if (this.refDate == null || sequence.getResetDate() == null) {
    return false;
  }
  if (!sequence.getYearlyResetOk() && !sequence.getMonthlyResetOk()) {
    return false;
  }
  if (!this.refDate.isAfter(sequence.getResetDate())) {
    return false;
  }
  if (sequence.getYearlyResetOk() && !this.refDate.equals(this.refDate.monthOfYear().withMinimumValue().dayOfMonth().withMinimumValue())) {
    return false;
  }
  if (sequence.getMonthlyResetOk() && !this.refDate.equals(this.refDate.dayOfMonth().withMinimumValue())) {
    return false;
  }
  sequence.setResetDate(refDate);
  sequence.setNextNum(1);
  return true;
}
Program: 58966
Project: 58966
Buggy source:
/** 
 * @param invoice OperationTypeSelect 1 : Achat fournisseur 2 : Avoir fournisseur 3 : Vente client 4 : Avoir client
 * @return
 * @throws AxelorException
 */
public Journal getJournal(Invoice invoice) throws AxelorException {
  Company company=invoice.getCompany();
  if (company != null) {
    AccountConfig accountConfig=company.getAccountConfig();
switch (invoice.getOperationTypeSelect()) {
case 1:
      if (invoice.getInTaxTotal().compareTo(BigDecimal.ZERO) == -1) {
        return accountConfigService.getSupplierCreditNoteJournal(accountConfig);
      }
 else {
        return accountConfigService.getSupplierPurchaseJournal(accountConfig);
      }
case 2:
    if (invoice.getInTaxTotal().compareTo(BigDecimal.ZERO) == -1) {
      return accountConfigService.getSupplierPurchaseJournal(accountConfig);
    }
 else {
      return accountConfigService.getSupplierCreditNoteJournal(accountConfig);
    }
case 3:
  if (invoice.getInTaxTotal().compareTo(BigDecimal.ZERO) == -1) {
    return accountConfigService.getCustomerCreditNoteJournal(accountConfig);
  }
 else {
    return accountConfigService.getCustomerSalesJournal(accountConfig);
  }
case 4:
if (invoice.getInTaxTotal().compareTo(BigDecimal.ZERO) == -1) {
  return accountConfigService.getCustomerSalesJournal(accountConfig);
}
 else {
  return accountConfigService.getCustomerCreditNoteJournal(accountConfig);
}
default :
throw new AxelorException(String.format(I18n.get(IExceptionMessage.JOURNAL_1),invoice.getInvoiceId()),IException.MISSING_FIELD);
}
}
return null;
}

Fixed version (ground truth):
/** 
 * @param invoice OperationTypeSelect 1 : Achat fournisseur 2 : Avoir fournisseur 3 : Vente client 4 : Avoir client
 * @return
 * @throws AxelorException
 */
public Journal getJournal(Invoice invoice) throws AxelorException {
  Company company=invoice.getCompany();
  if (company != null) {
    AccountConfig accountConfig=accountConfigService.getAccountConfig(company);
switch (invoice.getOperationTypeSelect()) {
case 1:
      if (invoice.getInTaxTotal().compareTo(BigDecimal.ZERO) == -1) {
        return accountConfigService.getSupplierCreditNoteJournal(accountConfig);
      }
 else {
        return accountConfigService.getSupplierPurchaseJournal(accountConfig);
      }
case 2:
    if (invoice.getInTaxTotal().compareTo(BigDecimal.ZERO) == -1) {
      return accountConfigService.getSupplierPurchaseJournal(accountConfig);
    }
 else {
      return accountConfigService.getSupplierCreditNoteJournal(accountConfig);
    }
case 3:
  if (invoice.getInTaxTotal().compareTo(BigDecimal.ZERO) == -1) {
    return accountConfigService.getCustomerCreditNoteJournal(accountConfig);
  }
 else {
    return accountConfigService.getCustomerSalesJournal(accountConfig);
  }
case 4:
if (invoice.getInTaxTotal().compareTo(BigDecimal.ZERO) == -1) {
  return accountConfigService.getCustomerSalesJournal(accountConfig);
}
 else {
  return accountConfigService.getCustomerCreditNoteJournal(accountConfig);
}
default :
throw new AxelorException(String.format(I18n.get(IExceptionMessage.JOURNAL_1),invoice.getInvoiceId()),IException.MISSING_FIELD);
}
}
return null;
}
Program: 58967
Project: 58967
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);
  InvoiceService is=Beans.get(InvoiceService.class);
  try {
    invoice=is.find(invoice.getId());
    Invoice refund=is.createRefund(invoice);
    response.setReload(true);
    response.setFlash(I18n.get(IExceptionMessage.INVOICE_2));
    ActionView.define(String.format("String_Node_Str",invoice.getInvoiceId())).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());
  }
 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);
  InvoiceService is=Beans.get(InvoiceService.class);
  try {
    invoice=is.find(invoice.getId());
    Invoice refund=is.createRefund(invoice);
    response.setReload(true);
    response.setFlash(I18n.get(IExceptionMessage.INVOICE_2));
    response.setView(ActionView.define(String.format(I18n.get(IExceptionMessage.INVOICE_4),invoice.getInvoiceId())).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);
  }
}
Program: 58968
Project: 58968
Buggy source:
/** 
 * Créer un avoir. <p> Un avoir est une facture "inversée". Tout le montant sont opposés à la facture originale. </p>
 * @param invoice
 * @return
 * @throws AxelorException 
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void createRefund(Invoice invoice) throws AxelorException ;

Fixed version (ground truth):
/** 
 * Créer un avoir. <p> Un avoir est une facture "inversée". Tout le montant sont opposés à la facture originale. </p>
 * @param invoice
 * @return
 * @throws AxelorException 
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public Invoice createRefund(Invoice invoice) throws AxelorException ;
Program: 58969
Project: 58969
Buggy source:
/** 
 * Créer un avoir. <p> Un avoir est une facture "inversée". Tout le montant sont opposés à la facture originale. </p>
 * @param invoice
 * @return
 * @throws AxelorException 
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void createRefund(Invoice invoice) throws AxelorException {
  LOG.debug("String_Node_Str",new Object[]{invoice.getInvoiceId()});
  invoice.addRefundInvoiceListItem((new RefundInvoice(invoice)).generate());
  save(invoice);
}

Fixed version (ground truth):
/** 
 * Créer un avoir. <p> Un avoir est une facture "inversée". Tout le montant sont opposés à la facture originale. </p>
 * @param invoice
 * @return
 * @throws AxelorException 
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public Invoice createRefund(Invoice invoice) throws AxelorException {
  LOG.debug("String_Node_Str",new Object[]{invoice.getInvoiceId()});
  Invoice refund=new RefundInvoice(invoice).generate();
  invoice.addRefundInvoiceListItem(refund);
  save(invoice);
  return refund;
}
Program: 58970
Project: 58970
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);
  InvoiceService is=Beans.get(InvoiceService.class);
  try {
    is.createRefund(is.find(invoice.getId()));
    response.setReload(true);
    response.setFlash(I18n.get(IExceptionMessage.INVOICE_2));
  }
 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);
  InvoiceService is=Beans.get(InvoiceService.class);
  try {
    invoice=is.find(invoice.getId());
    Invoice refund=is.createRefund(invoice);
    response.setReload(true);
    response.setFlash(I18n.get(IExceptionMessage.INVOICE_2));
    ActionView.define(String.format("String_Node_Str",invoice.getInvoiceId())).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());
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}
Program: 58971
Project: 58971
Buggy source:
@Override @Transactional public Message createMessage(String model,int id,String subject,String content,EmailAddress fromEmailAddress,List<EmailAddress> toEmailAddressList,List<EmailAddress> ccEmailAddressList,List<EmailAddress> bccEmailAddressList,MailAccount mailAccount,String linkPath,String addressBlock,int mediaTypeSelect){
  Message message=save(super.createMessage(content,fromEmailAddress,model,id,null,0,todayTime.toLocalDateTime(),false,STATUS_DRAFT,subject,TYPE_SENT,toEmailAddressList,ccEmailAddressList,bccEmailAddressList,mailAccount,linkPath,addressBlock,mediaTypeSelect));
  message.setCompany(userService.getUserActiveCompany());
  message.setSenderUser(userService.getUser());
  return message;
}

Fixed version (ground truth):
@Override @Transactional(rollbackOn={AxelorException.class,Exception.class}) public Message createMessage(String model,int id,String subject,String content,EmailAddress fromEmailAddress,List<EmailAddress> toEmailAddressList,List<EmailAddress> ccEmailAddressList,List<EmailAddress> bccEmailAddressList,MailAccount mailAccount,String linkPath,String addressBlock,int mediaTypeSelect){
  Message message=save(super.createMessage(content,fromEmailAddress,model,id,null,0,todayTime.toLocalDateTime(),false,STATUS_DRAFT,subject,TYPE_SENT,toEmailAddressList,ccEmailAddressList,bccEmailAddressList,mailAccount,linkPath,addressBlock,mediaTypeSelect));
  message.setCompany(userService.getUserActiveCompany());
  message.setSenderUser(userService.getUser());
  return message;
}
Program: 58972
Project: 58972
Buggy source:
@Override @Transactional public Message sendMessageByEmail(Message message){
  super.sendMessageByEmail(message);
  if (message.getStatusSelect() != null && message.getStatusSelect().equals(MessageRepository.STATUS_SENT)) {
    message.setSentDateT(GeneralService.getTodayDateTime().toLocalDateTime());
    save(message);
  }
  return message;
}

Fixed version (ground truth):
@Override @Transactional(rollbackOn={AxelorException.class,Exception.class}) public Message sendMessageByEmail(Message message){
  super.sendMessageByEmail(message);
  if (message.getStatusSelect() != null && message.getStatusSelect().equals(MessageRepository.STATUS_SENT)) {
    message.setSentDateT(GeneralService.getTodayDateTime().toLocalDateTime());
    save(message);
  }
  return message;
}
Program: 58973
Project: 58973
Buggy source:
@Transactional public Message createMessage(String model,int id,String subject,String content,EmailAddress fromEmailAddress,List<EmailAddress> toEmailAddressList,List<EmailAddress> ccEmailAddressList,List<EmailAddress> bccEmailAddressList,MailAccount mailAccount,String linkPath,String addressBlock,int mediaTypeSelect);

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public Message createMessage(String model,int id,String subject,String content,EmailAddress fromEmailAddress,List<EmailAddress> toEmailAddressList,List<EmailAddress> ccEmailAddressList,List<EmailAddress> bccEmailAddressList,MailAccount mailAccount,String linkPath,String addressBlock,int mediaTypeSelect);
Program: 58974
Project: 58974
Buggy source:
@Transactional public Message sendMessageByEmail(Message message);

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public Message sendMessageByEmail(Message message);
Program: 58976
Project: 58976
Buggy source:
private void sendMessage(Message message){
  if (message.getMediaTypeSelect() == 1) {
    message.setStatusSelect(MessageRepository.STATUS_SENT);
    message.setSentByEmail(false);
    message.setSentDateT(LocalDateTime.now());
    save(message);
  }
}

Fixed version (ground truth):
private void sendMessage(Message message){
  if (message.getMediaTypeSelect() == MEDIA_TYPE_MAIL) {
    message.setStatusSelect(MessageRepository.STATUS_SENT);
    message.setSentByEmail(false);
    message.setSentDateT(LocalDateTime.now());
    save(message);
  }
}
Program: 58977
Project: 58977
Buggy source:
@Transactional public Message sendMessageByEmail(Message message){
  try {
    this.sendByEmail(message);
    this.sendToUser(message);
    this.sendMessage(message);
  }
 catch (  MessagingException e) {
    e.printStackTrace();
  }
catch (  UnsupportedEncodingException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  return message;
}

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public Message sendMessageByEmail(Message message){
  try {
    this.sendByEmail(message);
    this.sendToUser(message);
    this.sendMessage(message);
  }
 catch (  MessagingException e) {
    e.printStackTrace();
  }
catch (  UnsupportedEncodingException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  return message;
}
Program: 58979
Project: 58979
Buggy source:
public List<EmailAddress> getEmailAddress(String recipients){
  List<EmailAddress> emailAddressList=Lists.newArrayList();
  if (recipients != null && !recipients.isEmpty()) {
    String[] toTab=recipients.split("String_Node_Str");
    for (    String s : toTab) {
      EmailAddress emailAddress=emailAddressRepo.findByAddress(s);
      if (emailAddress == null) {
        Map<String,Object> values=new HashMap<String,Object>();
        values.put("String_Node_Str",s);
        emailAddress=emailAddressRepo.create(values);
      }
      emailAddressList.add(emailAddress);
    }
  }
  return emailAddressList;
}

Fixed version (ground truth):
protected EmailAddress getEmailAddress(String recipient){
  if (Strings.isNullOrEmpty(recipient)) {
    return null;
  }
  EmailAddress emailAddress=emailAddressRepo.findByAddress(recipient);
  if (emailAddress == null) {
    Map<String,Object> values=new HashMap<String,Object>();
    values.put("String_Node_Str",recipient);
    emailAddress=emailAddressRepo.create(values);
  }
  return emailAddress;
}
Program: 58981
Project: 58981
Buggy source:
public void finish(ManufOrder manufOrder) throws AxelorException {
  if (manufOrder.getInStockMove() != null && manufOrder.getInStockMove().getStatusSelect() == IStockMove.STATUS_PLANNED) {
    stockMoveService.realize(manufOrder.getInStockMove());
  }
  if (manufOrder.getOutStockMove() != null && manufOrder.getOutStockMove().getStatusSelect() == IStockMove.STATUS_PLANNED) {
    stockMoveService.realize(manufOrder.getOutStockMove());
  }
}

Fixed version (ground truth):
public void finish(ManufOrder manufOrder) throws AxelorException {
  this.finishStockMove(manufOrder.getInStockMove());
  this.finishStockMove(manufOrder.getOutStockMove());
}
Program: 58982
Project: 58982
Buggy source:
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void finish(ManufOrder manufOrder) throws AxelorException {
  if (manufOrder.getOperationOrderList() != null) {
    for (    OperationOrder operationOrder : manufOrder.getOperationOrderList()) {
      if (operationOrder.getStatusSelect() == IOperationOrder.STATUS_IN_PROGRESS) {
        operationOrderWorkflowService.finish(operationOrder);
      }
    }
  }
  manufOrderStockMoveService.finish(manufOrder);
  manufOrder.setStatusSelect(IManufOrder.STATUS_FINISHED);
  save(manufOrder);
}

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void finish(ManufOrder manufOrder) throws AxelorException {
  if (manufOrder.getOperationOrderList() != null) {
    for (    OperationOrder operationOrder : manufOrder.getOperationOrderList()) {
      operationOrderWorkflowService.finish(operationOrder);
    }
  }
  manufOrderStockMoveService.finish(manufOrder);
  manufOrder.setStatusSelect(IManufOrder.STATUS_FINISHED);
  save(manufOrder);
}
Program: 58983
Project: 58983
Buggy source:
@Override public ManufOrder createManufOrder(Product product,BigDecimal qty,int priority,boolean isToInvoice,Company company,BillOfMaterial billOfMaterial,LocalDateTime plannedStartDateT) throws AxelorException {
  logger.debug("String_Node_Str",priority);
  ProdProcess prodProcess=billOfMaterial.getProdProcess();
  ManufOrder manufOrder=new ManufOrder(qty,company,null,priority,this.isManagedConsumedProduct(billOfMaterial),billOfMaterial,product,prodProcess,plannedStartDateT,IManufOrder.STATUS_DRAFT,isToInvoice);
  if (prodProcess != null && prodProcess.getProdProcessLineList() != null) {
    for (    ProdProcessLine prodProcessLine : this._sortProdProcessLineByPriority(prodProcess.getProdProcessLineList())) {
      manufOrder.addOperationOrderListItem(operationOrderServiceBusinessImpl.createOperationOrder(manufOrder,prodProcessLine,isToInvoice));
    }
  }
  if (!manufOrder.getIsConsProOnOperation()) {
    this.createToConsumeProdProductList(manufOrder);
  }
  this.createToProduceProdProductList(manufOrder);
  return manufOrder;
}

Fixed version (ground truth):
@Override public ManufOrder createManufOrder(Product product,BigDecimal qty,int priority,boolean isToInvoice,Company company,BillOfMaterial billOfMaterial,LocalDateTime plannedStartDateT) throws AxelorException {
  logger.debug("String_Node_Str",priority);
  ProdProcess prodProcess=billOfMaterial.getProdProcess();
  ManufOrder manufOrder=new ManufOrder(qty,company,null,priority,this.isManagedConsumedProduct(billOfMaterial),billOfMaterial,product,prodProcess,plannedStartDateT,IManufOrder.STATUS_DRAFT);
  manufOrder.setIsToInvoice(isToInvoice);
  if (prodProcess != null && prodProcess.getProdProcessLineList() != null) {
    for (    ProdProcessLine prodProcessLine : this._sortProdProcessLineByPriority(prodProcess.getProdProcessLineList())) {
      manufOrder.addOperationOrderListItem(operationOrderServiceBusinessImpl.createOperationOrder(manufOrder,prodProcessLine,isToInvoice));
    }
  }
  if (!manufOrder.getIsConsProOnOperation()) {
    this.createToConsumeProdProductList(manufOrder);
  }
  this.createToProduceProdProductList(manufOrder);
  return manufOrder;
}
Program: 58984
Project: 58984
Buggy source:
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public OperationOrder createOperationOrder(ManufOrder manufOrder,int priority,boolean isToInvoice,ProdResource prodResource,ProdResource machineProdResource,ProdProcessLine prodProcessLine) throws AxelorException {
  logger.debug("String_Node_Str",priority,manufOrder.getManufOrderSeq());
  String operationName=prodProcessLine.getName();
  OperationOrder operationOrder=new OperationOrder(priority,this.computeName(manufOrder,priority,operationName),operationName,manufOrder,prodResource,machineProdResource,IOperationOrder.STATUS_DRAFT,prodProcessLine,isToInvoice);
  this._createToConsumeProdProductList(operationOrder,prodProcessLine);
  this._createHumanResourceList(operationOrder,machineProdResource);
  return save(operationOrder);
}

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public OperationOrder createOperationOrder(ManufOrder manufOrder,int priority,boolean isToInvoice,ProdResource prodResource,ProdResource machineProdResource,ProdProcessLine prodProcessLine) throws AxelorException {
  logger.debug("String_Node_Str",priority,manufOrder.getManufOrderSeq());
  String operationName=prodProcessLine.getName();
  OperationOrder operationOrder=new OperationOrder(priority,this.computeName(manufOrder,priority,operationName),operationName,manufOrder,prodResource,machineProdResource,IOperationOrder.STATUS_DRAFT,prodProcessLine);
  operationOrder.setIsToInvoice(isToInvoice);
  this._createToConsumeProdProductList(operationOrder,prodProcessLine);
  this._createHumanResourceList(operationOrder,machineProdResource);
  return save(operationOrder);
}
Program: 58985
Project: 58985
Buggy source:
public ProductionOrder createProductionOrder(Project businessProject,boolean isToInvoice) throws AxelorException {
  return new ProductionOrder(this.getProductionOrderSeq(),isToInvoice,businessProject);
}

Fixed version (ground truth):
public ProductionOrder createProductionOrder(Project businessProject,boolean isToInvoice) throws AxelorException {
  ProductionOrder productionOrder=new ProductionOrder(this.getProductionOrderSeq());
  productionOrder.setBusinessProject(businessProject);
  productionOrder.setIsToInvoice(isToInvoice);
  return productionOrder;
}
Program: 58987
Project: 58987
Buggy source:
/** 
 * Fonction permettant de créer un Solde rapporté
 * @param reportedBalance Un A nouveau
 */
@Transactional public ReportedBalanceLine createReportedBalanceLine(ReportedBalance reportedBalance,BigDecimal amount,Year year){
  ReportedBalanceLine reportedBalanceLine=new ReportedBalanceLine();
  reportedBalanceLine.setReportedBalance(reportedBalance);
  reportedBalanceLine.setAmount(amount);
  reportedBalanceLine.setYear(year);
  reportedBalanceLineRepo.save(reportedBalanceLine);
  return reportedBalanceLine;
}

Fixed version (ground truth):
/** 
 * Fonction permettant de créer un Solde rapporté
 * @param reportedBalance Un A nouveau
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public ReportedBalanceLine createReportedBalanceLine(ReportedBalance reportedBalance,BigDecimal amount,Year year){
  ReportedBalanceLine reportedBalanceLine=new ReportedBalanceLine();
  reportedBalanceLine.setReportedBalance(reportedBalance);
  reportedBalanceLine.setAmount(amount);
  reportedBalanceLine.setYear(year);
  reportedBalanceLineRepo.save(reportedBalanceLine);
  return reportedBalanceLine;
}
Program: 58988
Project: 58988
Buggy source:
public Period getNextPeriod(Period period) throws AxelorException {
  Period nextPeriod=all().filter("String_Node_Str",period.getToDate(),period.getCompany()).fetchOne();
  if (nextPeriod == null || nextPeriod.getStatusSelect() == PeriodRepository.STATUS_CLOSED) {
    throw new AxelorException(String.format("String_Node_Str",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("String_Node_Str",period.getCompany().getName()),IException.CONFIGURATION_ERROR);
  }
  LOG.debug("String_Node_Str",nextPeriod);
  return period;
}
Program: 58989
Project: 58989
Buggy source:
public BigDecimal getCurrentQty(Location location,Product product){
  LocationLine locationLine=Beans.get(LocationLineService.class).getLocationLine(location,product);
  if (locationLine != null) {
    LOG.debug("String_Node_Str",locationLine.getCurrentQty());
    return locationLine.getCurrentQty();
  }
  return BigDecimal.ZERO;
}

Fixed version (ground truth):
public BigDecimal getCurrentQty(Location location,Product product){
  if (location != null && product != null) {
    LocationLine locationLine=Beans.get(LocationLineService.class).getLocationLine(location,product);
    if (locationLine != null) {
      LOG.debug("String_Node_Str",locationLine.getCurrentQty());
      return locationLine.getCurrentQty();
    }
  }
  return BigDecimal.ZERO;
}
Program: 58990
Project: 58990
Buggy source:
/** 
 * Détermine le numéro de facture
 * @param invoice
 * @param company
 * @throws AxelorException 
 */
protected void setInvoiceId() throws AxelorException {
  if (!Strings.isNullOrEmpty(invoice.getInvoiceId())) {
    return;
  }
switch (invoice.getOperationTypeSelect()) {
case InvoiceService.OPERATION_TYPE_SUPPLIER_PURCHASE:
    invoice.setInvoiceId(SequenceService.getSequenceNumber(IAdministration.SUPPLIER_INVOICE,invoice.getCompany()));
  break;
case InvoiceService.OPERATION_TYPE_SUPPLIER_REFUND:
invoice.setInvoiceId(SequenceService.getSequenceNumber(IAdministration.SUPPLIER_REFUND,invoice.getCompany()));
break;
case InvoiceService.OPERATION_TYPE_CLIENT_SALE:
invoice.setInvoiceId(SequenceService.getSequenceNumber(IAdministration.CUSTOMER_INVOICE,invoice.getCompany()));
break;
case InvoiceService.OPERATION_TYPE_CLIENT_REFUND:
invoice.setInvoiceId(SequenceService.getSequenceNumber(IAdministration.CUSTOMER_REFUND,invoice.getCompany()));
break;
default :
break;
}
if (invoice.getInvoiceId() == null) {
throw new AxelorException(String.format("String_Node_Str",invoice.getCompany().getName()),IException.CONFIGURATION_ERROR);
}
}

Fixed version (ground truth):
/** 
 * Détermine le numéro de facture
 * @param invoice
 * @param company
 * @throws AxelorException 
 */
protected void setInvoiceId() throws AxelorException {
  if (!Strings.isNullOrEmpty(invoice.getInvoiceId())) {
    return;
  }
switch (invoice.getOperationTypeSelect()) {
case InvoiceService.OPERATION_TYPE_SUPPLIER_PURCHASE:
    invoice.setInvoiceId(SequenceService.getSequenceNumber(IAdministration.SUPPLIER_INVOICE,invoice.getCompany()));
  break;
case InvoiceService.OPERATION_TYPE_SUPPLIER_REFUND:
invoice.setInvoiceId(SequenceService.getSequenceNumber(IAdministration.SUPPLIER_REFUND,invoice.getCompany()));
break;
case InvoiceService.OPERATION_TYPE_CLIENT_SALE:
invoice.setInvoiceId(SequenceService.getSequenceNumber(IAdministration.CUSTOMER_INVOICE,invoice.getCompany()));
break;
case InvoiceService.OPERATION_TYPE_CLIENT_REFUND:
invoice.setInvoiceId(SequenceService.getSequenceNumber(IAdministration.CUSTOMER_REFUND,invoice.getCompany()));
break;
default :
throw new AxelorException(String.format("String_Node_Str"),IException.MISSING_FIELD);
}
if (invoice.getInvoiceId() == null) {
throw new AxelorException(String.format("String_Node_Str",invoice.getCompany().getName()),IException.CONFIGURATION_ERROR);
}
}
Program: 58991
Project: 58991
Buggy source:
@Transactional 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);
  accountingSituationRepo.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,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);
  accountingSituationService.save(accountingSituation);
  return accountingSituation;
}
Program: 58992
Project: 58992
Buggy source:
@Inject public AccountCustomerService(){
  this.today=GeneralService.getTodayDate();
}

Fixed version (ground truth):
@Inject public AccountCustomerService(AccountingSituationService accountingSituationService){
  this.today=GeneralService.getTodayDate();
  this.accountingSituationService=accountingSituationService;
}
Program: 58993
Project: 58993
Buggy source:
/** 
 * Fonction permettant de calculer le solde total d'un tiers
 * @param partner Un tiers
 * @param company Une société
 * @return Le solde total
 */
public BigDecimal getBalance(Partner partner,Company company){
  LOG.debug("String_Node_Str",partner.getName(),company.getName());
  Query query=JPA.em().createNativeQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str").setParameter(1,partner).setParameter(2,company).setParameter(3,moveRepo.STATUS_VALIDATED);
  BigDecimal balance=(BigDecimal)query.getSingleResult();
  if (balance == null) {
    balance=BigDecimal.ZERO;
  }
  LOG.debug("String_Node_Str",balance);
  return balance;
}

Fixed version (ground truth):
/** 
 * Fonction permettant de calculer le solde total d'un tiers
 * @param partner Un tiers
 * @param company Une société
 * @return Le solde total
 */
public BigDecimal getBalance(Partner partner,Company company){
  LOG.debug("String_Node_Str",partner.getName(),company.getName());
  Query query=JPA.em().createNativeQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str").setParameter(1,partner).setParameter(2,company).setParameter(3,MoveRepository.STATUS_VALIDATED);
  BigDecimal balance=(BigDecimal)query.getSingleResult();
  if (balance == null) {
    balance=BigDecimal.ZERO;
  }
  LOG.debug("String_Node_Str",balance);
  return balance;
}
Program: 58994
Project: 58994
Buggy source:
/** 
 * Méthode permettant de mettre à jour les soldes du compte client d'un tiers.
 * @param accountingSituation Un compte client
 */
@Transactional public void updateCustomerAccount(AccountingSituation accountingSituation){
  LOG.debug("String_Node_Str");
  Partner partner=accountingSituation.getPartner();
  Company company=accountingSituation.getCompany();
  accountingSituation.setBalanceCustAccount(this.getBalance(partner,company));
  accountingSituation.setBalanceDueCustAccount(this.getBalanceDue(partner,company));
  accountingSituation.setBalanceDueReminderCustAccount(this.getBalanceDueReminder(partner,company));
  accountingSituationRepo.save(accountingSituation);
  LOG.debug("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Méthode permettant de mettre à jour les soldes du compte client d'un tiers.
 * @param accountingSituation Un compte client
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void updateCustomerAccount(AccountingSituation accountingSituation){
  LOG.debug("String_Node_Str");
  Partner partner=accountingSituation.getPartner();
  Company company=accountingSituation.getCompany();
  accountingSituation.setBalanceCustAccount(this.getBalance(partner,company));
  accountingSituation.setBalanceDueCustAccount(this.getBalanceDue(partner,company));
  accountingSituation.setBalanceDueReminderCustAccount(this.getBalanceDueReminder(partner,company));
  accountingSituationService.save(accountingSituation);
  LOG.debug("String_Node_Str");
}
Program: 58995
Project: 58995
Buggy source:
/** 
 * Méthode permettant de récupérer l'ensemble des lignes d'écriture pour une société et un tiers
 * @param partner Un tiers
 * @param company Une société
 * @return
 */
public List<? extends MoveLine> getMoveLine(Partner partner,Company company){
  return moveLineRepo.all().filter("String_Node_Str",partner,company).fetch();
}

Fixed version (ground truth):
/** 
 * Méthode permettant de récupérer l'ensemble des lignes d'écriture pour une société et un tiers
 * @param partner Un tiers
 * @param company Une société
 * @return
 */
public List<? extends MoveLine> getMoveLine(Partner partner,Company company){
  return Beans.get(MoveLineRepository.class).all().filter("String_Node_Str",partner,company).fetch();
}