nus-yam/ex-repair huggingface dataset:
Program: 58657
Project: 58657
Buggy source:
public File generateFile(BankOrder bankOrder) throws JAXBException, IOException, AxelorException, DatatypeConfigurationException {
  bankOrder.setFileGenerationDateTime(new LocalDateTime());
  PaymentMode paymentMode=bankOrder.getPaymentMode();
  BankOrderFileFormat bankOrderFileFormat=paymentMode.getBankOrderFileFormat();
  File file=null;
switch (bankOrderFileFormat.getOrderFileFormatSelect()) {
case BankOrderFileFormatRepository.FILE_FORMAT_pain_001_001_02_SCT:
    file=new BankOrderFile00100102Service(bankOrder).generateFile();
  break;
case BankOrderFileFormatRepository.FILE_FORMAT_pain_001_001_03_SCT:
file=new BankOrderFile00100103Service(bankOrder).generateFile();
break;
case BankOrderFileFormatRepository.FILE_FORMAT_pain_XXX_CFONB320_XCT:
file=new BankOrderFileAFB320Service(bankOrder).generateFile();
break;
default :
throw new AxelorException(I18n.get(IExceptionMessage.BANK_ORDER_FILE_UNKNOW_FORMAT),IException.INCONSISTENCY);
}
if (file == null) {
throw new AxelorException(I18n.get(String.format(IExceptionMessage.BANK_ORDER_ISSUE_DURING_FILE_GENERATION,bankOrder.getBankOrderSeq())),IException.INCONSISTENCY);
}
MetaFiles metaFiles=Beans.get(MetaFiles.class);
try (InputStream is=new FileInputStream(file)){
metaFiles.attach(is,file.getName(),bankOrder);
bankOrder.setFileToSend(metaFiles.upload(file));
}
 return file;
}

Fixed version (ground truth):
public File generateFile(BankOrder bankOrder) throws JAXBException, IOException, AxelorException, DatatypeConfigurationException {
  bankOrder.setFileGenerationDateTime(new LocalDateTime());
  BankOrderFileFormat bankOrderFileFormat=bankOrder.getBankOrderFileFormat();
  File file=null;
switch (bankOrderFileFormat.getOrderFileFormatSelect()) {
case BankOrderFileFormatRepository.FILE_FORMAT_pain_001_001_02_SCT:
    file=new BankOrderFile00100102Service(bankOrder).generateFile();
  break;
case BankOrderFileFormatRepository.FILE_FORMAT_pain_001_001_03_SCT:
file=new BankOrderFile00100103Service(bankOrder).generateFile();
break;
case BankOrderFileFormatRepository.FILE_FORMAT_pain_XXX_CFONB320_XCT:
file=new BankOrderFileAFB320Service(bankOrder).generateFile();
break;
default :
throw new AxelorException(I18n.get(IExceptionMessage.BANK_ORDER_FILE_UNKNOW_FORMAT),IException.INCONSISTENCY);
}
if (file == null) {
throw new AxelorException(I18n.get(String.format(IExceptionMessage.BANK_ORDER_ISSUE_DURING_FILE_GENERATION,bankOrder.getBankOrderSeq())),IException.INCONSISTENCY);
}
MetaFiles metaFiles=Beans.get(MetaFiles.class);
try (InputStream is=new FileInputStream(file)){
metaFiles.attach(is,file.getName(),bankOrder);
bankOrder.setFileToSend(metaFiles.upload(file));
}
 return file;
}
Program: 58658
Project: 58658
Buggy source:
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void validate(BankOrder bankOrder) throws JAXBException, IOException, AxelorException, DatatypeConfigurationException {
  bankOrder.setStatusSelect(BankOrderRepository.STATUS_VALIDATED);
  bankOrder.setValidationDateTime(new LocalDateTime());
  this.setSequenceOnBankOrderLines(bankOrder);
  File fileToSend=this.generateFile(bankOrder);
  ebicsService.sendFULRequest(bankOrder.getEbicsUser(),null,fileToSend,bankOrder.getBankOrderFileFormat().getOrderFileFormatSelect());
  bankOrderRepo.save(bankOrder);
}

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void validate(BankOrder bankOrder) throws JAXBException, IOException, AxelorException, DatatypeConfigurationException {
  bankOrder.setStatusSelect(BankOrderRepository.STATUS_VALIDATED);
  bankOrder.setValidationDateTime(new LocalDateTime());
  this.setSequenceOnBankOrderLines(bankOrder);
  this.setNbOfLines(bankOrder);
  File fileToSend=this.generateFile(bankOrder);
  ebicsService.sendFULRequest(bankOrder.getEbicsUser(),null,fileToSend,bankOrder.getBankOrderFileFormat().getOrderFileFormatSelect());
  bankOrderRepo.save(bankOrder);
}
Program: 58659
Project: 58659
Buggy source:
public BankOrderFileService(BankOrder bankOrder){
  this.paymentMode=bankOrder.getPaymentMode();
  this.bankOrderDate=bankOrder.getBankOrderDate();
  this.senderBankDetails=bankOrder.getSenderBankDetails();
  this.senderCompany=bankOrder.getSenderCompany();
  this.bankOrderCurrency=bankOrder.getBankOrderCurrency();
  this.bankOrderTotalAmount=bankOrder.getBankOrderTotalAmount();
  this.arithmeticTotal=bankOrder.getArithmeticTotal();
  this.nbOfLines=bankOrder.getNbOfLines();
  this.generationDateTime=bankOrder.getFileGenerationDateTime();
  this.validationDateTime=bankOrder.getValidationDateTime();
  this.bankOrderSeq=bankOrder.getBankOrderSeq();
  this.bankOrderLineList=bankOrder.getBankOrderLineList();
  this.isMultiDates=bankOrder.getIsMultiDate();
  this.isMultiCurrencies=bankOrder.getIsMultiCurrency();
}

Fixed version (ground truth):
public BankOrderFileService(BankOrder bankOrder){
  this.paymentMode=bankOrder.getPaymentMode();
  this.bankOrderFileFormat=bankOrder.getBankOrderFileFormat();
  this.bankOrderDate=bankOrder.getBankOrderDate();
  this.senderBankDetails=bankOrder.getSenderBankDetails();
  this.senderCompany=bankOrder.getSenderCompany();
  this.bankOrderCurrency=bankOrder.getBankOrderCurrency();
  this.bankOrderTotalAmount=bankOrder.getBankOrderTotalAmount();
  this.arithmeticTotal=bankOrder.getArithmeticTotal();
  this.nbOfLines=bankOrder.getNbOfLines();
  this.generationDateTime=bankOrder.getFileGenerationDateTime();
  this.validationDateTime=bankOrder.getValidationDateTime();
  this.bankOrderSeq=bankOrder.getBankOrderSeq();
  this.bankOrderLineList=bankOrder.getBankOrderLineList();
  this.isMultiDates=bankOrder.getIsMultiDate();
  this.isMultiCurrencies=bankOrder.getIsMultiCurrency();
}
Program: 58660
Project: 58660
Buggy source:
public String computeFileName(){
  return String.format("String_Node_Str",paymentMode.getBankOrderFileFormat().getOrderFileFormatSelect(),generationDateTime.toString("String_Node_Str"),fileExtension);
}

Fixed version (ground truth):
public String computeFileName(){
  return String.format("String_Node_Str",bankOrderFileFormat.getOrderFileFormatSelect(),generationDateTime.toString("String_Node_Str"),fileExtension);
}
Program: 58663
Project: 58663
Buggy source:
public void historicExpense(ActionRequest request,ActionResponse response){
  User user=AuthUtils.getUser();
  Employee employee=user.getEmployee();
  ActionViewBuilder actionView=ActionView.define(I18n.get("String_Node_Str")).model(Expense.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str");
  actionView.domain("String_Node_Str").context("String_Node_Str",user.getActiveCompany());
  if (employee == null || !employee.getHrManager()) {
    actionView.domain(actionView.get().getDomain() + "String_Node_Str").context("String_Node_Str",user.getId());
  }
  response.setView(actionView.map());
}

Fixed version (ground truth):
public void historicExpense(ActionRequest request,ActionResponse response){
  User user=AuthUtils.getUser();
  Employee employee=user.getEmployee();
  ActionViewBuilder actionView=ActionView.define(I18n.get("String_Node_Str")).model(Expense.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str");
  actionView.domain("String_Node_Str").context("String_Node_Str",user.getActiveCompany());
  if (employee == null || !employee.getHrManager()) {
    actionView.domain(actionView.get().getDomain() + "String_Node_Str").context("String_Node_Str",user);
  }
  response.setView(actionView.map());
}
Program: 58664
Project: 58664
Buggy source:
public void historicExtraHours(ActionRequest request,ActionResponse response){
  User user=AuthUtils.getUser();
  Employee employee=user.getEmployee();
  ActionViewBuilder actionView=ActionView.define(I18n.get("String_Node_Str")).model(ExtraHours.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str");
  actionView.domain("String_Node_Str").context("String_Node_Str",user.getActiveCompany());
  if (employee == null || !employee.getHrManager()) {
    actionView.domain(actionView.get().getDomain() + "String_Node_Str").context("String_Node_Str",user.getId());
  }
  response.setView(actionView.map());
}

Fixed version (ground truth):
public void historicExtraHours(ActionRequest request,ActionResponse response){
  User user=AuthUtils.getUser();
  Employee employee=user.getEmployee();
  ActionViewBuilder actionView=ActionView.define(I18n.get("String_Node_Str")).model(ExtraHours.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str");
  actionView.domain("String_Node_Str").context("String_Node_Str",user.getActiveCompany());
  if (employee == null || !employee.getHrManager()) {
    actionView.domain(actionView.get().getDomain() + "String_Node_Str").context("String_Node_Str",user);
  }
  response.setView(actionView.map());
}
Program: 58665
Project: 58665
Buggy source:
public void historicLeave(ActionRequest request,ActionResponse response){
  User user=AuthUtils.getUser();
  Employee employee=user.getEmployee();
  ActionViewBuilder actionView=ActionView.define(I18n.get("String_Node_Str")).model(LeaveRequest.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str");
  actionView.domain("String_Node_Str").context("String_Node_Str",user.getActiveCompany());
  if (employee == null || !employee.getHrManager()) {
    actionView.domain(actionView.get().getDomain() + "String_Node_Str").context("String_Node_Str",user.getId());
  }
  response.setView(actionView.map());
}

Fixed version (ground truth):
public void historicLeave(ActionRequest request,ActionResponse response){
  User user=AuthUtils.getUser();
  Employee employee=user.getEmployee();
  ActionViewBuilder actionView=ActionView.define(I18n.get("String_Node_Str")).model(LeaveRequest.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str");
  actionView.domain("String_Node_Str").context("String_Node_Str",user.getActiveCompany());
  if (employee == null || !employee.getHrManager()) {
    actionView.domain(actionView.get().getDomain() + "String_Node_Str").context("String_Node_Str",user);
  }
  response.setView(actionView.map());
}
Program: 58666
Project: 58666
Buggy source:
public void historicTimesheet(ActionRequest request,ActionResponse response){
  User user=AuthUtils.getUser();
  Employee employee=user.getEmployee();
  ActionViewBuilder actionView=ActionView.define(I18n.get("String_Node_Str")).model(Timesheet.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str");
  actionView.domain("String_Node_Str").context("String_Node_Str",user.getActiveCompany());
  if (employee == null || !employee.getHrManager()) {
    actionView.domain(actionView.get().getDomain() + "String_Node_Str").context("String_Node_Str",user.getId());
  }
  response.setView(actionView.map());
}

Fixed version (ground truth):
public void historicTimesheet(ActionRequest request,ActionResponse response){
  User user=AuthUtils.getUser();
  Employee employee=user.getEmployee();
  ActionViewBuilder actionView=ActionView.define(I18n.get("String_Node_Str")).model(Timesheet.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str");
  actionView.domain("String_Node_Str").context("String_Node_Str",user.getActiveCompany());
  if (employee == null || !employee.getHrManager()) {
    actionView.domain(actionView.get().getDomain() + "String_Node_Str").context("String_Node_Str",user);
  }
  response.setView(actionView.map());
}
Program: 58667
Project: 58667
Buggy source:
public void validateTimesheet(ActionRequest request,ActionResponse response){
  User user=AuthUtils.getUser();
  Employee employee=user.getEmployee();
  ActionViewBuilder actionView=ActionView.define(I18n.get("String_Node_Str")).model(Timesheet.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").context("String_Node_Str",Beans.get(GeneralService.class).getTodayDate());
  actionView.domain("String_Node_Str").context("String_Node_Str",user.getActiveCompany());
  if (employee == null || !employee.getHrManager()) {
    if (employee != null && employee.getManager() != null) {
      actionView.domain(actionView.get().getDomain() + "String_Node_Str").context("String_Node_Str",user.getId());
    }
 else {
      actionView.domain(actionView.get().getDomain() + "String_Node_Str").context("String_Node_Str",user.getId());
    }
  }
  response.setView(actionView.map());
}

Fixed version (ground truth):
public void validateTimesheet(ActionRequest request,ActionResponse response){
  User user=AuthUtils.getUser();
  Employee employee=user.getEmployee();
  ActionViewBuilder actionView=ActionView.define(I18n.get("String_Node_Str")).model(Timesheet.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").context("String_Node_Str",Beans.get(GeneralService.class).getTodayDate());
  actionView.domain("String_Node_Str").context("String_Node_Str",user.getActiveCompany());
  if (employee == null || !employee.getHrManager()) {
    if (employee != null && employee.getManager() != null) {
      actionView.domain(actionView.get().getDomain() + "String_Node_Str").context("String_Node_Str",user);
    }
 else {
      actionView.domain(actionView.get().getDomain() + "String_Node_Str").context("String_Node_Str",user);
    }
  }
  response.setView(actionView.map());
}
Program: 58668
Project: 58668
Buggy source:
public String expenseValidateTag(){
  return hrMenuTagServiceProvider.get().countRecordsTag(Expense.class,ExpenseRepository.STATUS_VALIDATED);
}

Fixed version (ground truth):
public String expenseValidateTag(){
  return hrMenuTagServiceProvider.get().countRecordsTag(Expense.class,ExpenseRepository.STATUS_CONFIRMED);
}
Program: 58669
Project: 58669
Buggy source:
private boolean checkProperty(Property property,String[] field){
  if (property == null) {
    log.debug("String_Node_Str");
    return false;
  }
  if (field.length > 1) {
    if (property.getTarget() == null) {
      log.debug("String_Node_Str",property.getName());
      return false;
    }
    String[] subFields=Arrays.copyOfRange(field,1,field.length);
    Property subProperty=Mapper.of(property.getTarget()).getProperty(subFields[0]);
    return checkProperty(subProperty,subFields);
  }
  return true;
}

Fixed version (ground truth):
private Property checkProperty(Property property,String[] field){
  if (field.length > 1) {
    if (property.getTarget() == null) {
      log.debug("String_Node_Str",property.getName());
      return null;
    }
    String[] subFields=Arrays.copyOfRange(field,1,field.length);
    String name=subFields[0];
    if (name.startsWith("String_Node_Str")) {
      name=name.substring(1);
    }
    name=isValidName(name);
    if (name == null) {
      return null;
    }
    property=Mapper.of(property.getTarget()).getProperty(name);
    if (subFields[0].startsWith("String_Node_Str") && property != null && property.isCollection()) {
      return null;
    }
    return checkProperty(property,subFields);
  }
  return property;
}
Program: 58670
Project: 58670
Buggy source:
private void validateFields(Class<?> klass,String[] row){
  Mapper mapper=Mapper.of(klass);
  List<String> invalidFields=new ArrayList<String>();
  List<String> invalidRules=new ArrayList<String>();
  for (  String name : row) {
    String[] column=name.split("String_Node_Str");
    log.debug("String_Node_Str",name);
    String field[]=column[0].split("String_Node_Str");
    if (!checkProperty(mapper.getProperty(field[0]),field)) {
      invalidFields.add(name);
    }
    if (column.length > 1) {
      String[] rules=column[1].replaceAll("String_Node_Str","String_Node_Str").split("String_Node_Str");
      if (!RULES.containsAll(Arrays.asList(rules))) {
        invalidRules.add(name);
      }
    }
  }
  if (!invalidFields.isEmpty()) {
    logger.append(String.format(I18n.get("String_Node_Str"),klass.getName(),invalidFields));
  }
  if (!invalidRules.isEmpty()) {
    logger.append(String.format(I18n.get("String_Node_Str"),klass.getName(),invalidRules));
  }
}

Fixed version (ground truth):
private void validateFields(Class<?> klass,String[] row){
  Mapper mapper=Mapper.of(klass);
  List<String> invalidFields=new ArrayList<String>();
  List<String> invalidRules=new ArrayList<String>();
  for (  String col : row) {
    if (!isValidColumn(col)) {
      continue;
    }
    String[] cols=col.split("String_Node_Str");
    log.debug("String_Node_Str",col);
    String[] field=cols[0].split("String_Node_Str");
    String name=isValidName(field[0]);
    if (name == null) {
      invalidFields.add(name);
    }
    Property property=checkProperty(mapper.getProperty(name),field);
    if (property == null) {
      invalidFields.add(col);
    }
    if (cols.length > 1) {
      String[] rules=cols[1].replaceAll("String_Node_Str","String_Node_Str").split("String_Node_Str");
      if (!RULES.containsAll(Arrays.asList(rules))) {
        invalidRules.add(col);
      }
 else       if (field.length > 1 && (property.getTarget() != null || !cols[0].contains("String_Node_Str"))) {
        log.debug("String_Node_Str",property.getName());
        invalidRules.add(col);
      }
    }
  }
  if (!invalidFields.isEmpty()) {
    logger.append(String.format(I18n.get("String_Node_Str"),klass.getName(),invalidFields));
  }
  if (!invalidRules.isEmpty()) {
    logger.append(String.format(I18n.get("String_Node_Str"),klass.getName(),invalidRules));
  }
}
Program: 58671
Project: 58671
Buggy source:
public Expense compute(Expense expense){
  BigDecimal exTaxTotal=BigDecimal.ZERO;
  BigDecimal taxTotal=BigDecimal.ZERO;
  BigDecimal inTaxTotal=BigDecimal.ZERO;
  List<ExpenseLine> expenseLineList=expense.getExpenseLineList();
  for (  ExpenseLine expenseLine : expenseLineList) {
    exTaxTotal=exTaxTotal.add(expenseLine.getUntaxedAmount());
    taxTotal=taxTotal.add(expenseLine.getTotalTax());
    inTaxTotal=inTaxTotal.add(expenseLine.getTotalAmount());
  }
  expense.setExTaxTotal(exTaxTotal);
  expense.setTaxTotal(taxTotal);
  expense.setInTaxTotal(inTaxTotal);
  return expense;
}

Fixed version (ground truth):
public Expense compute(Expense expense){
  BigDecimal exTaxTotal=BigDecimal.ZERO;
  BigDecimal taxTotal=BigDecimal.ZERO;
  BigDecimal inTaxTotal=BigDecimal.ZERO;
  List<ExpenseLine> expenseLineList=expense.getExpenseLineList();
  if (expenseLineList != null) {
    for (    ExpenseLine expenseLine : expenseLineList) {
      exTaxTotal=exTaxTotal.add(expenseLine.getUntaxedAmount());
      taxTotal=taxTotal.add(expenseLine.getTotalTax());
      inTaxTotal=inTaxTotal.add(expenseLine.getTotalAmount());
    }
  }
  expense.setExTaxTotal(exTaxTotal);
  expense.setTaxTotal(taxTotal);
  expense.setInTaxTotal(inTaxTotal);
  return expense;
}
Program: 58673
Project: 58673
Buggy source:
private void updateDocMap(DataReader reader){
  String[] keys=reader.getKeys();
  if (keys == null || keys.length == 1) {
    return;
  }
  keys=Arrays.copyOfRange(keys,1,keys.length);
  for (  String key : keys) {
    log.debug("String_Node_Str",key);
    String lastKey=key;
    for (int count=0; count < reader.getTotalLines(key); count++) {
      String[] row=reader.read(key,count);
      if (row == null) {
        continue;
      }
      if (count == 0) {
        if (row.length > CommonService.HELP) {
          docMap.put(lastKey,Arrays.copyOfRange(row,CommonService.HELP,row.length));
        }
        continue;
      }
      String name=getFieldName(row);
      String type=row[CommonService.TYPE];
      if (type == null) {
        continue;
      }
      String model=row[CommonService.MODEL];
      if (model != null) {
        model=common.inflector.camelize(model);
      }
      String view=row[CommonService.VIEW];
      if (model != null && view == null) {
        view=ViewLoaderService.getDefaultViewName(model,"String_Node_Str");
      }
      if (updateComment(lastKey,type,row)) {
        continue;
      }
      lastKey=model + "String_Node_Str" + view+ "String_Node_Str"+ getFieldType(type)+ "String_Node_Str"+ name;
      if (row.length > CommonService.HELP) {
        docMap.put(lastKey,Arrays.copyOfRange(row,CommonService.HELP,row.length));
      }
    }
  }
}

Fixed version (ground truth):
private void updateDocMap(DataReader reader){
  String[] keys=reader.getKeys();
  if (keys == null || keys.length == 1) {
    return;
  }
  keys=Arrays.copyOfRange(keys,1,keys.length);
  for (  String key : keys) {
    log.debug("String_Node_Str",key);
    String lastKey=key;
    for (int count=1; count < reader.getTotalLines(key); count++) {
      String[] row=reader.read(key,count);
      if (row == null || row.length < CommonService.HEADERS.length) {
        continue;
      }
      String name=getFieldName(row);
      String type=row[CommonService.TYPE];
      if (type == null) {
        continue;
      }
      String model=row[CommonService.MODEL];
      if (model != null) {
        model=common.inflector.camelize(model);
      }
      String view=row[CommonService.VIEW];
      if (model != null && view == null) {
        view=ViewLoaderService.getDefaultViewName(model,"String_Node_Str");
      }
      if (updateComment(lastKey,type,row)) {
        continue;
      }
      lastKey=model + "String_Node_Str" + view+ "String_Node_Str"+ getFieldType(type)+ "String_Node_Str"+ name;
      if (row[CommonService.HELP] != null || row[CommonService.HELP_FR] != null) {
        docMap.put(lastKey,new String[]{row[CommonService.HELP],row[CommonService.HELP_FR]});
      }
    }
  }
}
Program: 58674
Project: 58674
Buggy source:
private String[] addHelp(String docKey,String[] vals){
  if (!docMap.isEmpty()) {
    if (docKey == null) {
      docKey=getDocKey(vals);
    }
    if (docMap.containsKey(docKey)) {
      return (String[])ArrayUtils.addAll(vals,docMap.get(docKey));
    }
  }
  return vals;
}

Fixed version (ground truth):
private String[] addHelp(String docKey,String[] vals){
  if (!docMap.isEmpty()) {
    if (docKey == null) {
      docKey=getDocKey(vals);
    }
    if (docMap.containsKey(docKey)) {
      String[] help=docMap.get(docKey);
      if (help[0] != null) {
        vals[CommonService.HELP]=help[0];
      }
      if (help[1] != null) {
        vals[CommonService.HELP_FR]=help[1];
      }
    }
  }
  return vals;
}
Program: 58675
Project: 58675
Buggy source:
/** 
 * Sends a segment to the ebics bank server.
 * @param factory the content factory that contain the segment data.
 * @param segmentNumber the segment number
 * @param lastSegment is it the last segment?
 * @param transactionId the transaction Id
 * @param orderType the order type
 * @throws IOException
 * @throws EbicsException
 */
public void sendFile(ContentFactory factory,int segmentNumber,boolean lastSegment,byte[] transactionId,OrderType orderType) throws IOException, AxelorException {
  UTransferRequestElement uploader;
  HttpRequestSender sender;
  TransferResponseElement response;
  int httpCode;
  uploader=new UTransferRequestElement(session,orderType,segmentNumber,lastSegment,transactionId,factory);
  sender=new HttpRequestSender(session);
  uploader.build();
  uploader.validate();
  httpCode=sender.send(new ByteArrayContentFactory(uploader.prettyPrint()));
  Utils.checkHttpCode(httpCode);
  response=new TransferResponseElement(sender.getResponseBody(),DefaultEbicsRootElement.generateName(orderType));
  response.build();
  response.report();
}

Fixed version (ground truth):
/** 
 * Sends a segment to the ebics bank server.
 * @param factory the content factory that contain the segment data.
 * @param segmentNumber the segment number
 * @param lastSegment is it the last segment?
 * @param transactionId the transaction Id
 * @param orderType the order type
 * @throws IOException
 * @throws EbicsException
 */
public void sendFile(ContentFactory factory,int segmentNumber,boolean lastSegment,byte[] transactionId,OrderType orderType,File certFile) throws IOException, AxelorException {
  UTransferRequestElement uploader;
  HttpRequestSender sender;
  TransferResponseElement response;
  int httpCode;
  uploader=new UTransferRequestElement(session,orderType,segmentNumber,lastSegment,transactionId,factory);
  sender=new HttpRequestSender(session);
  uploader.build();
  uploader.validate();
  httpCode=sender.send(new ByteArrayContentFactory(uploader.prettyPrint()),certFile);
  Utils.checkHttpCode(httpCode);
  response=new TransferResponseElement(sender.getResponseBody(),DefaultEbicsRootElement.generateName(orderType));
  response.build();
  response.report();
}
Program: 58676
Project: 58676
Buggy source:
/** 
 * Fetches a given portion of a file.
 * @param orderType the order type
 * @param segmentNumber the segment number
 * @param lastSegment is it the last segment?
 * @param transactionId the transaction ID
 * @param joiner the portions joiner
 * @throws IOException communication error
 * @throws EbicsException server generated error
 */
public void fetchFile(OrderType orderType,int segmentNumber,boolean lastSegment,byte[] transactionId,Joiner joiner) throws IOException, AxelorException {
  DTransferRequestElement downloader;
  HttpRequestSender sender;
  DTransferResponseElement response;
  int httpCode;
  sender=new HttpRequestSender(session);
  downloader=new DTransferRequestElement(session,orderType,segmentNumber,lastSegment,transactionId);
  downloader.build();
  downloader.validate();
  httpCode=sender.send(new ByteArrayContentFactory(downloader.prettyPrint()));
  Utils.checkHttpCode(httpCode);
  response=new DTransferResponseElement(sender.getResponseBody(),orderType,DefaultEbicsRootElement.generateName(orderType));
  response.build();
  response.report();
  joiner.append(response.getOrderData());
}

Fixed version (ground truth):
/** 
 * Fetches a given portion of a file.
 * @param orderType the order type
 * @param segmentNumber the segment number
 * @param lastSegment is it the last segment?
 * @param transactionId the transaction ID
 * @param joiner the portions joiner
 * @throws IOException communication error
 * @throws EbicsException server generated error
 */
public void fetchFile(OrderType orderType,int segmentNumber,boolean lastSegment,byte[] transactionId,Joiner joiner,File certFile) throws IOException, AxelorException {
  DTransferRequestElement downloader;
  HttpRequestSender sender;
  DTransferResponseElement response;
  int httpCode;
  sender=new HttpRequestSender(session);
  downloader=new DTransferRequestElement(session,orderType,segmentNumber,lastSegment,transactionId);
  downloader.build();
  downloader.validate();
  httpCode=sender.send(new ByteArrayContentFactory(downloader.prettyPrint()),certFile);
  Utils.checkHttpCode(httpCode);
  response=new DTransferResponseElement(sender.getResponseBody(),orderType,DefaultEbicsRootElement.generateName(orderType));
  response.build();
  response.report();
  joiner.append(response.getOrderData());
}
Program: 58679
Project: 58679
Buggy source:
/** 
 * Sends the public part of the protocol keys to the bank.
 * @param orderId the order ID. Let it null to generate a random one.
 * @throws IOException communication error
 * @throws JDOMException 
 * @throws EbicsException server generated error message
 */
public void sendHIA(String orderId) throws IOException, AxelorException, JDOMException {
  HIARequestElement request;
  KeyManagementResponseElement response;
  HttpRequestSender sender;
  int httpCode;
  sender=new HttpRequestSender(session);
  request=new HIARequestElement(session,orderId);
  request.build();
  request.validate();
  httpCode=sender.send(new ByteArrayContentFactory(request.prettyPrint()));
  EbicsUtils.checkHttpCode(httpCode);
  response=new KeyManagementResponseElement(sender.getResponseBody(),"String_Node_Str");
  response.build();
  response.report();
}

Fixed version (ground truth):
/** 
 * Sends the public part of the protocol keys to the bank.
 * @param orderId the order ID. Let it null to generate a random one.
 * @throws IOException communication error
 * @throws JDOMException 
 * @throws EbicsException server generated error message
 */
public void sendHIA(String orderId,File certFile) throws IOException, AxelorException, JDOMException {
  HIARequestElement request;
  KeyManagementResponseElement response;
  HttpRequestSender sender;
  int httpCode;
  sender=new HttpRequestSender(session);
  request=new HIARequestElement(session,orderId);
  request.build();
  request.validate();
  httpCode=sender.send(new ByteArrayContentFactory(request.prettyPrint()),certFile);
  EbicsUtils.checkHttpCode(httpCode);
  response=new KeyManagementResponseElement(sender.getResponseBody(),"String_Node_Str");
  response.build();
  response.report();
}
Program: 58680
Project: 58680
Buggy source:
/** 
 * Sends the SPR order to the bank. After that you have to start over with sending INI and HIA.
 * @throws IOException Communication exception
 * @throws AxelorException 
 * @throws JDOMException 
 * @throws EbicsException Error message generated by the bank.
 */
public void lockAccess() throws IOException, AxelorException, JDOMException {
  HttpRequestSender sender;
  SPRRequestElement request;
  SPRResponseElement response;
  int httpCode;
  sender=new HttpRequestSender(session);
  request=new SPRRequestElement(session);
  request.build();
  request.validate();
  httpCode=sender.send(new ByteArrayContentFactory(request.prettyPrint()));
  Utils.checkHttpCode(httpCode);
  response=new SPRResponseElement(sender.getResponseBody());
  response.build();
  response.report();
}

Fixed version (ground truth):
/** 
 * Sends the SPR order to the bank. After that you have to start over with sending INI and HIA.
 * @throws IOException Communication exception
 * @throws AxelorException 
 * @throws JDOMException 
 * @throws EbicsException Error message generated by the bank.
 */
public void lockAccess(File certFile) throws IOException, AxelorException, JDOMException {
  HttpRequestSender sender;
  SPRRequestElement request;
  SPRResponseElement response;
  int httpCode;
  sender=new HttpRequestSender(session);
  request=new SPRRequestElement(session);
  request.build();
  request.validate();
  httpCode=sender.send(new ByteArrayContentFactory(request.prettyPrint()),certFile);
  Utils.checkHttpCode(httpCode);
  response=new SPRResponseElement(sender.getResponseBody());
  response.build();
  response.report();
}
Program: 58681
Project: 58681
Buggy source:
/** 
 * Sends the user's signature key (A005) to the bank. After successful operation the user is in state "initialized".
 * @param orderId the order ID. Let it null to generate a random one.
 * @throws EbicsException server generated error message
 * @throws IOException communication error
 * @throws AxelorException 
 * @throws JDOMException 
 */
public void sendINI(String orderId) throws IOException, AxelorException, JDOMException {
  INIRequestElement request;
  KeyManagementResponseElement response;
  HttpRequestSender sender;
  int httpCode;
  sender=new HttpRequestSender(session);
  log.debug("String_Node_Str");
  request=new INIRequestElement(session,orderId);
  log.debug("String_Node_Str");
  request.build();
  log.debug("String_Node_Str");
  request.validate();
  log.debug("String_Node_Str");
  httpCode=sender.send(new ByteArrayContentFactory(request.prettyPrint()));
  log.debug("String_Node_Str");
  EbicsUtils.checkHttpCode(httpCode);
  log.debug("String_Node_Str");
  response=new KeyManagementResponseElement(sender.getResponseBody(),"String_Node_Str");
  log.debug("String_Node_Str");
  response.build();
  log.debug("String_Node_Str");
  response.report();
  log.debug("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Sends the user's signature key (A005) to the bank. After successful operation the user is in state "initialized".
 * @param orderId the order ID. Let it null to generate a random one.
 * @throws EbicsException server generated error message
 * @throws IOException communication error
 * @throws AxelorException 
 * @throws JDOMException 
 */
public void sendINI(String orderId,File certFile) throws IOException, AxelorException, JDOMException {
  INIRequestElement request;
  KeyManagementResponseElement response;
  HttpRequestSender sender;
  int httpCode;
  sender=new HttpRequestSender(session);
  log.debug("String_Node_Str");
  request=new INIRequestElement(session,orderId);
  log.debug("String_Node_Str");
  request.build();
  log.debug("String_Node_Str");
  request.validate();
  log.debug("String_Node_Str");
  httpCode=sender.send(new ByteArrayContentFactory(request.prettyPrint()),certFile);
  log.debug("String_Node_Str");
  EbicsUtils.checkHttpCode(httpCode);
  log.debug("String_Node_Str");
  response=new KeyManagementResponseElement(sender.getResponseBody(),"String_Node_Str");
  log.debug("String_Node_Str");
  response.build();
  log.debug("String_Node_Str");
  response.report();
  log.debug("String_Node_Str");
}
Program: 58682
Project: 58682
Buggy source:
@Override public BankOrder save(BankOrder entity){
  try {
    Beans.get(BankOrderService.class).generateSequence(entity);
    return super.save(entity);
  }
 catch (  Exception e) {
    throw new PersistenceException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
@Override public BankOrder save(BankOrder entity){
  try {
    BankOrderService bankOrderService=Beans.get(BankOrderService.class);
    bankOrderService.generateSequence(entity);
    if (entity.getStatusSelect() == BankOrderRepository.STATUS_DRAFT || entity.getStatusSelect() == BankOrderRepository.STATUS_AWAITING_SIGNATURE) {
      entity.setAmount(bankOrderService.computeTotalAmount(entity));
    }
    return super.save(entity);
  }
 catch (  Exception e) {
    throw new PersistenceException(e.getLocalizedMessage());
  }
}
Program: 58683
Project: 58683
Buggy source:
@Override @Transactional public BankOrder generateSequence(BankOrder bankOrder){
  if (bankOrder.getBankOrderSeq() == null && bankOrder.getId() != null) {
    bankOrder.setBankOrderSeq("String_Node_Str" + bankOrder.getId());
    bankOrderRepo.save(bankOrder);
  }
  return bankOrder;
}

Fixed version (ground truth):
@Override @Transactional public BankOrder generateSequence(BankOrder bankOrder){
  if (bankOrder.getBankOrderSeq() == null && bankOrder.getId() != null) {
    bankOrder.setBankOrderSeq("String_Node_Str" + StringTool.fillStringLeft(Long.toString(bankOrder.getId()),'0',6));
    bankOrderRepo.save(bankOrder);
  }
  return bankOrder;
}
Program: 58684
Project: 58684
Buggy source:
public void generateFile(BankOrder bankOrder) throws JAXBException, IOException, AxelorException, DatatypeConfigurationException {
  bankOrder.setFileGenerationDateTime(new LocalDateTime());
  PaymentMode paymentMode=bankOrder.getPaymentMode();
  BankOrderFileFormat bankOrderFileFormat=paymentMode.getBankOrderFileFormat();
  File file=null;
switch (bankOrderFileFormat.getOrderFileFormatSelect()) {
case BankOrderFileFormatRepository.FILE_FORMAT_pain_001_001_02:
    file=new BankOrderFile00100102Service(bankOrder).generateFile();
  break;
case BankOrderFileFormatRepository.FILE_FORMAT_pain_001_001_03:
file=new BankOrderFile00100103Service(bankOrder).generateFile();
break;
case BankOrderFileFormatRepository.FILE_FORMAT_AFB_320:
file=new BankOrderFileAFB320Service(bankOrder).generateFile();
break;
default :
break;
}
try (InputStream is=new FileInputStream(file)){
Beans.get(MetaFiles.class).attach(is,file.getName(),bankOrder);
}
 }

Fixed version (ground truth):
public void generateFile(BankOrder bankOrder) throws JAXBException, IOException, AxelorException, DatatypeConfigurationException {
  bankOrder.setFileGenerationDateTime(new LocalDateTime());
  PaymentMode paymentMode=bankOrder.getPaymentMode();
  BankOrderFileFormat bankOrderFileFormat=paymentMode.getBankOrderFileFormat();
  File file=null;
switch (bankOrderFileFormat.getOrderFileFormatSelect()) {
case BankOrderFileFormatRepository.FILE_FORMAT_pain_001_001_02:
    file=new BankOrderFile00100102Service(bankOrder).generateFile();
  break;
case BankOrderFileFormatRepository.FILE_FORMAT_pain_001_001_03:
file=new BankOrderFile00100103Service(bankOrder).generateFile();
break;
case BankOrderFileFormatRepository.FILE_FORMAT_AFB_320:
file=new BankOrderFileAFB320Service(bankOrder).generateFile();
break;
default :
break;
}
if (file != null) {
try (InputStream is=new FileInputStream(file)){
Beans.get(MetaFiles.class).attach(is,file.getName(),bankOrder);
}
 }
}
Program: 58685
Project: 58685
Buggy source:
@Transactional public void validate(BankOrder bankOrder) throws JAXBException, IOException, AxelorException, DatatypeConfigurationException {
  bankOrder.setStatusSelect(BankOrderRepository.STATUS_VALIDATED);
  bankOrder.setValidationDateTime(new LocalDateTime());
  bankOrderRepo.save(bankOrder);
  this.generateFile(bankOrder);
}

Fixed version (ground truth):
@Transactional public void validate(BankOrder bankOrder) throws JAXBException, IOException, AxelorException, DatatypeConfigurationException {
  bankOrder.setStatusSelect(BankOrderRepository.STATUS_VALIDATED);
  bankOrder.setValidationDateTime(new LocalDateTime());
  this.setSequenceOnBankOrderLines(bankOrder);
  this.generateFile(bankOrder);
  bankOrderRepo.save(bankOrder);
}
Program: 58688
Project: 58688
Buggy source:
/** 
 * Procédure permettant de vérifier que la chaine de caractère ne contient que des entier
 * @param s La chaine de caractère à tester
 * @param company Une société
 * @throws AxelorException
 */
public void testDigital(String value) throws AxelorException {
  if (!StringTool.isDigital(value)) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.CFONB_TOOL_DIGITAL_ZONE_NOT_CORRECT),value),IException.CONFIGURATION_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Procédure permettant de vérifier que la chaine de caractère ne contient que des entier
 * @param s La chaine de caractère à tester
 * @param company Une société
 * @throws AxelorException
 */
public void testDigital(String value,String zone) throws AxelorException {
  if (!StringTool.isDigital(value)) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.CFONB_TOOL_DIGITAL_ZONE_NOT_CORRECT),zone,value),IException.CONFIGURATION_ERROR);
  }
}
Program: 58689
Project: 58689
Buggy source:
public String createZone(String numOfZone,String value,String status,String format,int length) throws AxelorException {
  String zone=value;
switch (status) {
case STATUS_MANDATORY:
    this.checkFilled(zone,numOfZone);
  break;
case STATUS_OPTIONAL:
break;
case STATUS_DEPENDENT:
break;
case STATUS_NOT_USED:
zone="String_Node_Str";
break;
default :
break;
}
switch (format) {
case FORMAT_ALPHA_NUMERIC:
zone=StringTool.fillStringRight(zone,' ',length);
break;
case FORMAT_NUMERIC:
this.testDigital(zone);
zone=StringTool.fillStringLeft(zone,'0',length);
break;
default :
break;
}
return zone;
}

Fixed version (ground truth):
public String createZone(String numOfZone,String value,String status,String format,int length) throws AxelorException {
  String zone=value;
switch (status) {
case STATUS_MANDATORY:
    this.checkFilled(zone,numOfZone);
  break;
case STATUS_OPTIONAL:
if (zone == null) {
  zone="String_Node_Str";
}
break;
case STATUS_DEPENDENT:
if (zone == null) {
zone="String_Node_Str";
}
break;
case STATUS_NOT_USED:
zone="String_Node_Str";
break;
default :
break;
}
switch (format) {
case FORMAT_ALPHA_NUMERIC:
zone=StringTool.fillStringRight(zone,' ',length);
break;
case FORMAT_NUMERIC:
this.testDigital(zone,numOfZone);
zone=StringTool.fillStringLeft(zone,'0',length);
break;
default :
break;
}
return zone;
}
Program: 58690
Project: 58690
Buggy source:
/** 
 * Procédure permettant de vérifier la longueur d'un enregistrement CFONB
 * @param s Un enregistrement CFONB
 * @param company Une société
 * @param type Le type d'enregistrement : <ul> <li>0 = émetteur</li> <li>1 = destinataire</li> <li>2 = total</li> <li>3 = entête</li> <li>4 = détail</li> <li>5 = fin</li> </ul>
 * @param size La longueur de l'enregistrement
 * @throws AxelorException
 */
public void testLength(String s,int size) throws AxelorException {
  if (s.length() != size) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.CFONB_TOOL_NB_OF_CHAR_PER_LINE),GeneralServiceImpl.EXCEPTION,size),IException.CONFIGURATION_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Procédure permettant de vérifier la longueur d'un enregistrement CFONB
 * @param s Un enregistrement CFONB
 * @param company Une société
 * @param type Le type d'enregistrement : <ul> <li>0 = émetteur</li> <li>1 = destinataire</li> <li>2 = total</li> <li>3 = entête</li> <li>4 = détail</li> <li>5 = fin</li> </ul>
 * @param size La longueur de l'enregistrement
 * @throws AxelorException
 */
public void testLength(String s,int size) throws AxelorException {
  if (s.length() != size) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.CFONB_TOOL_NB_OF_CHAR_PER_LINE),size),IException.CONFIGURATION_ERROR);
  }
}
Program: 58691
Project: 58691
Buggy source:
@Inject public BankOrderFile00100102Service(BankOrder bankOrder){
  super(bankOrder);
  context="String_Node_Str";
}

Fixed version (ground truth):
@Inject public BankOrderFile00100102Service(BankOrder bankOrder){
  super(bankOrder);
  context="String_Node_Str";
  fileExtension=FILE_EXTENSION_XML;
}
Program: 58692
Project: 58692
Buggy source:
@Inject public BankOrderFile00100103Service(BankOrder bankOrder){
  super(bankOrder);
  context="String_Node_Str";
}

Fixed version (ground truth):
@Inject public BankOrderFile00100103Service(BankOrder bankOrder){
  super(bankOrder);
  context="String_Node_Str";
  fileExtension=FILE_EXTENSION_XML;
}
Program: 58694
Project: 58694
Buggy source:
/** 
 * Initialiser l'ensemble des listes de ligne de tva d'une facture
 * @param invoice
 */
protected void initInvoiceLineTaxList(Invoice invoice){
  if (invoice.getInvoiceLineTaxList() == null) {
    invoice.setInvoiceLineTaxList(new ArrayList<InvoiceLineTax>());
  }
 else {
    invoice.getInvoiceLineTaxList().clear();
  }
}

Fixed version (ground truth):
/** 
 * Initiate the list of invoice tax lines
 * @param invoice
 */
protected void initInvoiceLineTaxList(Invoice invoice){
  if (invoice.getInvoiceLineTaxList() == null) {
    invoice.setInvoiceLineTaxList(new ArrayList<InvoiceLineTax>());
  }
 else {
    invoice.getInvoiceLineTaxList().clear();
  }
}
Program: 58695
Project: 58695
Buggy source:
/** 
 * Calculer le montant d'une facture. <p> Le calcul est basé sur les lignes de TVA préalablement créées. </p>
 * @param invoice
 * @throws AxelorException
 */
public void computeInvoice(Invoice invoice) throws AxelorException {
  invoice.setExTaxTotal(BigDecimal.ZERO);
  invoice.setTaxTotal(BigDecimal.ZERO);
  invoice.setInTaxTotal(BigDecimal.ZERO);
  invoice.setCompanyExTaxTotal(BigDecimal.ZERO);
  invoice.setCompanyTaxTotal(BigDecimal.ZERO);
  invoice.setCompanyInTaxTotal(BigDecimal.ZERO);
  for (  InvoiceLineTax invoiceLineTax : invoice.getInvoiceLineTaxList()) {
    invoice.setExTaxTotal(invoice.getExTaxTotal().add(invoiceLineTax.getExTaxBase()));
    invoice.setTaxTotal(invoice.getTaxTotal().add(invoiceLineTax.getTaxTotal()));
    invoice.setInTaxTotal(invoice.getInTaxTotal().add(invoiceLineTax.getInTaxTotal()));
    invoice.setCompanyExTaxTotal(invoice.getCompanyExTaxTotal().add(invoiceLineTax.getCompanyExTaxBase()));
    invoice.setCompanyTaxTotal(invoice.getCompanyTaxTotal().add(invoiceLineTax.getCompanyTaxTotal()));
    invoice.setCompanyInTaxTotal(invoice.getCompanyInTaxTotal().add(invoiceLineTax.getCompanyInTaxTotal()));
  }
  logger.debug("String_Node_Str",new Object[]{invoice.getExTaxTotal(),invoice.getTaxTotal(),invoice.getInTaxTotal()});
}

Fixed version (ground truth):
/** 
 * Compute the invoice amounts <p> The compute is based on invoice tax lines. </p>
 * @param invoice
 * @throws AxelorException
 */
public void computeInvoice(Invoice invoice) throws AxelorException {
  invoice.setExTaxTotal(BigDecimal.ZERO);
  invoice.setTaxTotal(BigDecimal.ZERO);
  invoice.setInTaxTotal(BigDecimal.ZERO);
  invoice.setCompanyExTaxTotal(BigDecimal.ZERO);
  invoice.setCompanyTaxTotal(BigDecimal.ZERO);
  invoice.setCompanyInTaxTotal(BigDecimal.ZERO);
  for (  InvoiceLineTax invoiceLineTax : invoice.getInvoiceLineTaxList()) {
    invoice.setExTaxTotal(invoice.getExTaxTotal().add(invoiceLineTax.getExTaxBase()));
    invoice.setTaxTotal(invoice.getTaxTotal().add(invoiceLineTax.getTaxTotal()));
    invoice.setInTaxTotal(invoice.getInTaxTotal().add(invoiceLineTax.getInTaxTotal()));
    invoice.setCompanyExTaxTotal(invoice.getCompanyExTaxTotal().add(invoiceLineTax.getCompanyExTaxBase()));
    invoice.setCompanyTaxTotal(invoice.getCompanyTaxTotal().add(invoiceLineTax.getCompanyTaxTotal()));
    invoice.setCompanyInTaxTotal(invoice.getCompanyInTaxTotal().add(invoiceLineTax.getCompanyInTaxTotal()));
  }
  invoice.setAmountRemaining(invoice.getInTaxTotal());
  logger.debug("String_Node_Str",new Object[]{invoice.getExTaxTotal(),invoice.getTaxTotal(),invoice.getInTaxTotal()});
}
Program: 58697
Project: 58697
Buggy source:
/** 
 * @param paymentMove
 * @param moveLineSeq
 * @param payerPartner
 * @param moveLineToPay
 * @param amountToPay
 * @param paymentInvoiceToPay
 * @return
 * @throws AxelorException
 */
public MoveLine payMoveLine(Move paymentMove,int moveLineSeq,Partner payerPartner,MoveLine moveLineToPay,BigDecimal amountToPay,PaymentInvoiceToPay paymentInvoiceToPay,boolean isDebitToPay,LocalDate paymentDate) throws AxelorException {
  String invoiceName="String_Node_Str";
  if (moveLineToPay.getMove().getInvoice() != null) {
    invoiceName=moveLineToPay.getMove().getInvoice().getInvoiceId();
  }
 else {
    invoiceName=paymentInvoiceToPay.getPaymentVoucher().getRef();
  }
  MoveLine moveLine=moveLineService.createMoveLine(paymentMove,payerPartner,moveLineToPay.getAccount(),amountToPay,!isDebitToPay,paymentDate,moveLineSeq,invoiceName);
  paymentMove.addMoveLineListItem(moveLine);
  paymentInvoiceToPay.setMoveLineGenerated(moveLine);
  Reconcile reconcile=reconcileService.createReconcile(moveLineToPay,moveLine,amountToPay,true);
  log.debug("String_Node_Str",reconcile);
  reconcileService.confirmReconcile(reconcile,true);
  return moveLine;
}

Fixed version (ground truth):
/** 
 * @param paymentMove
 * @param moveLineSeq
 * @param payerPartner
 * @param moveLineToPay
 * @param amountToPay
 * @param paymentInvoiceToPay
 * @return
 * @throws AxelorException
 */
public MoveLine payMoveLine(Move paymentMove,int moveLineSeq,Partner payerPartner,MoveLine moveLineToPay,BigDecimal amountToPay,PaymentInvoiceToPay paymentInvoiceToPay,boolean isDebitToPay,LocalDate paymentDate) throws AxelorException {
  String invoiceName="String_Node_Str";
  if (moveLineToPay.getMove().getInvoice() != null) {
    invoiceName=moveLineToPay.getMove().getInvoice().getInvoiceId();
  }
 else {
    invoiceName=paymentInvoiceToPay.getPaymentVoucher().getRef();
  }
  MoveLine moveLine=moveLineService.createMoveLine(paymentMove,payerPartner,moveLineToPay.getAccount(),amountToPay,!isDebitToPay,paymentDate,moveLineSeq,invoiceName);
  paymentMove.addMoveLineListItem(moveLine);
  paymentInvoiceToPay.setMoveLineGenerated(moveLine);
  BigDecimal amountInCompanyCurrency=moveLine.getDebit().add(moveLine.getCredit());
  Reconcile reconcile=reconcileService.createReconcile(moveLineToPay,moveLine,amountInCompanyCurrency,true);
  log.debug("String_Node_Str",reconcile);
  reconcileService.confirmReconcile(reconcile,true);
  return moveLine;
}
Program: 58698
Project: 58698
Buggy source:
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void resetImputation(PaymentVoucher paymentVoucher){
  paymentVoucher.getPaymentInvoiceToPayList().clear();
  paymentVoucherRepository.save(paymentVoucher);
}

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void resetImputation(PaymentVoucher paymentVoucher) throws AxelorException {
  paymentVoucher.getPaymentInvoiceToPayList().clear();
  this.searchDueElements(paymentVoucher);
}