nus-yam/ex-repair huggingface dataset:
Program: 59167
Project: 59167
Buggy source:
public void getProductInformation(ActionRequest request,ActionResponse response) throws AxelorException {
  InvoiceLine invoiceLine=request.getContext().asType(InvoiceLine.class);
  Invoice invoice=invoiceLine.getInvoice();
  if (invoice == null) {
    invoice=request.getContext().getParentContext().asType(Invoice.class);
  }
  if (invoice != null && invoiceLine.getProduct() != null) {
    try {
      boolean isPurchase=invoiceLineService.isPurchase(invoice);
      BigDecimal price=invoiceLineService.getUnitPrice(invoice,invoiceLine,isPurchase);
      response.setValue("String_Node_Str",invoiceLineService.getVatLine(invoice,invoiceLine,isPurchase));
      response.setValue("String_Node_Str",invoiceLine.getProduct().getName());
      PriceList priceList=invoice.getPriceList();
      if (priceList != null) {
        PriceListLine priceListLine=invoiceLineService.getPriceListLine(invoiceLine,priceList);
        if (priceList.getIsDisplayed()) {
          response.setValue("String_Node_Str",priceListService.getDiscountAmount(priceListLine,price));
          response.setValue("String_Node_Str",priceListService.getDiscountTypeSelect(priceListLine));
        }
 else {
          price=priceListService.getUnitPriceDiscounted(priceListLine,price);
        }
      }
      response.setValue("String_Node_Str",price);
    }
 catch (    Exception e) {
      response.setFlash(e.getMessage());
    }
  }
}

Fixed version (ground truth):
public void getProductInformation(ActionRequest request,ActionResponse response) throws AxelorException {
  InvoiceLine invoiceLine=request.getContext().asType(InvoiceLine.class);
  Invoice invoice=invoiceLine.getInvoice();
  if (invoice == null) {
    invoice=request.getContext().getParentContext().asType(Invoice.class);
  }
  if (invoice != null && invoiceLine.getProduct() != null) {
    try {
      boolean isPurchase=invoiceLineService.isPurchase(invoice);
      BigDecimal price=invoiceLineService.getUnitPrice(invoice,invoiceLine,isPurchase);
      response.setValue("String_Node_Str",invoiceLineService.getVatLine(invoice,invoiceLine,isPurchase));
      response.setValue("String_Node_Str",invoiceLine.getProduct().getName());
      PriceList priceList=invoice.getPriceList();
      if (priceList != null) {
        PriceListLine priceListLine=invoiceLineService.getPriceListLine(invoiceLine,priceList);
        Map<String,Object> discounts=priceListService.getDiscounts(priceList,priceListLine,price);
        response.setValue("String_Node_Str",discounts.get("String_Node_Str"));
        response.setValue("String_Node_Str",discounts.get("String_Node_Str"));
        if (discounts.get("String_Node_Str") != null) {
          price=(BigDecimal)discounts.get("String_Node_Str");
        }
      }
      response.setValue("String_Node_Str",price);
    }
 catch (    Exception e) {
      response.setFlash(e.getMessage());
    }
  }
}
Program: 59168
Project: 59168
Buggy source:
public BigDecimal computeDiscount(PurchaseOrderLine purchaseOrderLine){
  BigDecimal unitPrice=purchaseOrderLine.getPrice();
  if (purchaseOrderLine.getDiscountTypeSelect() == IPriceListLine.AMOUNT_TYPE_FIXED) {
    return unitPrice.add(purchaseOrderLine.getDiscountAmount());
  }
 else   if (purchaseOrderLine.getDiscountTypeSelect() == IPriceListLine.AMOUNT_TYPE_PERCENT) {
    return unitPrice.multiply(BigDecimal.ONE.add(purchaseOrderLine.getDiscountAmount().divide(new BigDecimal(100))));
  }
  return unitPrice;
}

Fixed version (ground truth):
public BigDecimal computeDiscount(PurchaseOrderLine purchaseOrderLine){
  return priceListService.computeDiscount(purchaseOrderLine.getPrice(),purchaseOrderLine.getDiscountTypeSelect(),purchaseOrderLine.getDiscountAmount());
}
Program: 59170
Project: 59170
Buggy source:
public BigDecimal computeDiscount(SalesOrderLine salesOrderLine){
  BigDecimal unitPrice=salesOrderLine.getPrice();
  if (salesOrderLine.getDiscountTypeSelect() == IPriceListLine.AMOUNT_TYPE_FIXED) {
    return unitPrice.add(salesOrderLine.getDiscountAmount());
  }
 else   if (salesOrderLine.getDiscountTypeSelect() == IPriceListLine.AMOUNT_TYPE_PERCENT) {
    return unitPrice.multiply(BigDecimal.ONE.add(salesOrderLine.getDiscountAmount().divide(new BigDecimal(100))));
  }
  return unitPrice;
}

Fixed version (ground truth):
public BigDecimal computeDiscount(SalesOrderLine salesOrderLine){
  return priceListService.computeDiscount(salesOrderLine.getPrice(),salesOrderLine.getDiscountTypeSelect(),salesOrderLine.getDiscountAmount());
}
Program: 59172
Project: 59172
Buggy source:
public void generateInvoice(ActionRequest request,ActionResponse response){
  StockMove stockMove=request.getContext().asType(StockMove.class);
  Invoice invoice=null;
  int numInvoice=0;
  try {
    stockMove=StockMove.find(stockMove.getId());
    if (stockMove.getSalesOrder() != null) {
      invoice=stockMoveInvoiceService.createInvoiceFromSalesOrder(stockMove,stockMove.getSalesOrder());
      if (invoice != null)       numInvoice++;
    }
    if (stockMove.getPurchaseOrder() != null) {
      invoice=stockMoveInvoiceService.createInvoiceFromPurchaseOrder(stockMove,stockMove.getPurchaseOrder());
      if (invoice != null)       numInvoice++;
    }
    if (numInvoice > 0) {
      response.setReload(true);
      if (numInvoice == 1)       response.setFlash("String_Node_Str");
 else       response.setFlash(numInvoice + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
public void generateInvoice(ActionRequest request,ActionResponse response){
  StockMove stockMove=request.getContext().asType(StockMove.class);
  Invoice invoice=null;
  try {
    stockMove=StockMove.find(stockMove.getId());
    if (stockMove.getSalesOrder() != null) {
      invoice=stockMoveInvoiceService.createInvoiceFromSalesOrder(stockMove,stockMove.getSalesOrder());
    }
    if (stockMove.getPurchaseOrder() != null) {
      invoice=stockMoveInvoiceService.createInvoiceFromPurchaseOrder(stockMove,stockMove.getPurchaseOrder());
    }
    if (invoice != null) {
      response.setReload(true);
      response.setFlash("String_Node_Str");
    }
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}
Program: 59173
Project: 59173
Buggy source:
public Task createTask(SalesOrderLine salesOrderLine) throws AxelorException {
  Task task=new Task();
  SalesOrder salesOrder=salesOrderLine.getSalesOrder();
  Project project=salesOrder.getProject();
  task.setProject(project);
  task.setSalesOrderLine(salesOrderLine);
  task.setProduct(salesOrderLine.getProduct());
  task.setQty(salesOrderLine.getQty());
  task.setPrice(salesOrderLine.getPrice());
  task.setName(salesOrderLine.getProductName());
  task.setDescription(salesOrderLine.getDescription());
  task.setStartDateT(todayTime);
  task.setIsTimesheetAffected(true);
  task.setIsToInvoice(salesOrderLine.getIsToInvoice());
  task.setInvoicingDate(salesOrderLine.getInvoicingDate());
  task.setStatusSelect(ITask.STATUS_DRAFT);
  task.setAmountToInvoice(currencyService.getAmountCurrencyConverted(salesOrder.getCurrency(),project.getCompany().getCurrency(),salesOrderLine.getAmountRemainingToBeInvoiced(),todayTime.toLocalDate()));
  task.setEstimatedAmount(salesOrderLine.getCompanyExTaxTotal());
  return task;
}

Fixed version (ground truth):
public Task createTask(SalesOrderLine salesOrderLine) throws AxelorException {
  Task task=new Task();
  SalesOrder salesOrder=salesOrderLine.getSalesOrder();
  Project project=salesOrder.getProject();
  task.setProject(project);
  task.setSalesOrderLine(salesOrderLine);
  task.setProduct(salesOrderLine.getProduct());
  task.setQty(salesOrderLine.getQty());
  task.setPrice(this.computeDiscount(salesOrderLine));
  task.setName(salesOrderLine.getProductName());
  task.setDescription(salesOrderLine.getDescription());
  task.setStartDateT(todayTime);
  task.setIsTimesheetAffected(true);
  task.setIsToInvoice(salesOrderLine.getIsToInvoice());
  task.setInvoicingDate(salesOrderLine.getInvoicingDate());
  task.setStatusSelect(ITask.STATUS_DRAFT);
  task.setAmountToInvoice(currencyService.getAmountCurrencyConverted(salesOrder.getCurrency(),project.getCompany().getCurrency(),salesOrderLine.getAmountRemainingToBeInvoiced(),todayTime.toLocalDate()));
  task.setEstimatedAmount(salesOrderLine.getCompanyExTaxTotal());
  return task;
}
Program: 59174
Project: 59174
Buggy source:
public void createTaskByLines(ActionRequest request,ActionResponse response) throws AxelorException {
  SalesOrder salesOrder=request.getContext().asType(SalesOrder.class);
  if (salesOrder != null) {
    taskService.get().createTasks(salesOrder);
  }
}

Fixed version (ground truth):
public void createTaskByLines(ActionRequest request,ActionResponse response) throws AxelorException {
  SalesOrder salesOrder=request.getContext().asType(SalesOrder.class);
  taskService.get().createTasks(salesOrder);
}
Program: 59175
Project: 59175
Buggy source:
public PriceListLine getPriceListLine(PurchaseOrderLine purchaseOrderLine,PriceList priceList){
  return priceListService.getPriceListLine(purchaseOrderLine.getProduct(),priceList);
}

Fixed version (ground truth):
public PriceListLine getPriceListLine(PurchaseOrderLine purchaseOrderLine,PriceList priceList){
  return priceListService.getPriceListLine(purchaseOrderLine.getProduct(),purchaseOrderLine.getQty(),priceList);
}
Program: 59176
Project: 59176
Buggy source:
public PriceListLine getPriceListLine(SalesOrderLine salesOrderLine,PriceList priceList){
  return priceListService.getPriceListLine(salesOrderLine.getProduct(),priceList);
}

Fixed version (ground truth):
public PriceListLine getPriceListLine(SalesOrderLine salesOrderLine,PriceList priceList){
  return priceListService.getPriceListLine(salesOrderLine.getProduct(),salesOrderLine.getQty(),priceList);
}
Program: 59177
Project: 59177
Buggy source:
public PriceListLine getPriceListLine(SalesOrderSubLine salesOrderSubLine,PriceList priceList){
  return priceListService.getPriceListLine(salesOrderSubLine.getProduct(),priceList);
}

Fixed version (ground truth):
public PriceListLine getPriceListLine(SalesOrderSubLine salesOrderSubLine,PriceList priceList){
  return priceListService.getPriceListLine(salesOrderSubLine.getProduct(),salesOrderSubLine.getQty(),priceList);
}
Program: 59178
Project: 59178
Buggy source:
public PriceListLine getPriceListLine(Product product,PriceList priceList){
  PriceListLine priceListLine=null;
  if (product != null && priceList != null) {
    priceListLine=this.getPriceListLine(product,priceList.getPriceListLineList());
    if (priceListLine == null) {
      priceListLine=this.getPriceListLine(product.getProductCategory(),priceList.getPriceListLineList());
    }
  }
  return priceListLine;
}

Fixed version (ground truth):
public PriceListLine getPriceListLine(Product product,BigDecimal qty,PriceList priceList){
  PriceListLine priceListLine=null;
  if (product != null && priceList != null) {
    priceListLine=PriceListLine.all().filter("String_Node_Str",product,qty).fetchOne();
    if (priceListLine == null && product.getProductCategory() != null) {
      priceListLine=PriceListLine.all().filter("String_Node_Str",product.getProductCategory(),qty).fetchOne();
    }
  }
  return priceListLine;
}
Program: 59179
Project: 59179
Buggy source:
public PurchaseOrder _computePurchaseOrderLines(PurchaseOrder purchaseOrder){
  if (purchaseOrder.getPurchaseOrderLineList() != null) {
    for (    PurchaseOrderLine purchaseOrderLine : purchaseOrder.getPurchaseOrderLineList()) {
      purchaseOrderLine.setExTaxTotal(purchaseOrderLineService.computePurchaseOrderLine(purchaseOrderLine));
    }
  }
  return purchaseOrder;
}

Fixed version (ground truth):
public PurchaseOrder _computePurchaseOrderLines(PurchaseOrder purchaseOrder) throws AxelorException {
  if (purchaseOrder.getPurchaseOrderLineList() != null) {
    for (    PurchaseOrderLine purchaseOrderLine : purchaseOrder.getPurchaseOrderLineList()) {
      purchaseOrderLine.setExTaxTotal(purchaseOrderLineService.computePurchaseOrderLine(purchaseOrderLine));
      purchaseOrderLine.setCompanyExTaxTotal(purchaseOrderLineService.getCompanyExTaxTotal(purchaseOrderLine.getExTaxTotal(),purchaseOrder));
    }
  }
  return purchaseOrder;
}
Program: 59180
Project: 59180
Buggy source:
public SalesOrder _computeSalesOrderLines(SalesOrder salesOrder){
  if (salesOrder.getSalesOrderLineList() != null) {
    for (    SalesOrderLine salesOrderLine : salesOrder.getSalesOrderLineList()) {
      salesOrderLine.setExTaxTotal(salesOrderLineService.computeSalesOrderLine(salesOrderLine));
    }
  }
  return salesOrder;
}

Fixed version (ground truth):
public SalesOrder _computeSalesOrderLines(SalesOrder salesOrder) throws AxelorException {
  if (salesOrder.getSalesOrderLineList() != null) {
    for (    SalesOrderLine salesOrderLine : salesOrder.getSalesOrderLineList()) {
      salesOrderLine.setExTaxTotal(salesOrderLineService.computeSalesOrderLine(salesOrderLine));
      salesOrderLine.setCompanyExTaxTotal(salesOrderLineService.getCompanyExTaxTotal(salesOrderLine.getExTaxTotal(),salesOrder));
    }
  }
  return salesOrder;
}
Program: 59182
Project: 59182
Buggy source:
@Inject private AxelorSettings(){
  InputStream is=Thread.currentThread().getContextClassLoader().getResourceAsStream("String_Node_Str");
  if (is == null) {
    throw new RuntimeException("String_Node_Str");
  }
  properties=new Properties();
  try {
    EntityManagerFactory emf=JPA.em().getEntityManagerFactory();
    properties.load(is);
    properties.put("String_Node_Str",emf.getProperties().get("String_Node_Str"));
    properties.put("String_Node_Str",emf.getProperties().get("String_Node_Str"));
    properties.put("String_Node_Str",emf.getProperties().get("String_Node_Str"));
    String dataSource=String.format("String_Node_Str",properties.get("String_Node_Str"),properties.get("String_Node_Str"),properties.get("String_Node_Str"));
    properties.put("String_Node_Str",dataSource);
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Inject private AxelorSettings(){
  InputStream is=Thread.currentThread().getContextClassLoader().getResourceAsStream("String_Node_Str");
  if (is == null) {
    throw new RuntimeException("String_Node_Str");
  }
  properties=new Properties();
  try {
    EntityManagerFactory emf=JPA.em().getEntityManagerFactory();
    properties.load(is);
    properties.put("String_Node_Str",emf.getProperties().get("String_Node_Str"));
    properties.put("String_Node_Str",emf.getProperties().get("String_Node_Str"));
    InputStream res=Thread.currentThread().getContextClassLoader().getResourceAsStream("String_Node_Str");
    String text=CharStreams.toString(new InputStreamReader(res,Charsets.UTF_8));
    Pattern pat=Pattern.compile("String_Node_Str",Pattern.CASE_INSENSITIVE);
    Matcher mat=pat.matcher(text);
    while (mat.find()) {
      properties.put("String_Node_Str",mat.group(1));
    }
    String dataSource=String.format("String_Node_Str",properties.get("String_Node_Str"),properties.get("String_Node_Str"),properties.get("String_Node_Str"));
    properties.put("String_Node_Str",dataSource);
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 59186
Project: 59186
Buggy source:
public void createsTargets(TargetConfiguration targetConfiguration) throws AxelorException {
  if (targetConfiguration.getPeriodTypeSelect() == ITarget.NONE) {
    Target target=this.createTarget(targetConfiguration,targetConfiguration.getFromDate(),targetConfiguration.getToDate());
    this.update(target);
  }
 else {
    LocalDate oldDate=targetConfiguration.getFromDate();
    for (LocalDate date=oldDate; date.isBefore(targetConfiguration.getToDate()) || date.isEqual(targetConfiguration.getToDate()); date=this.getNextDate(targetConfiguration.getPeriodTypeSelect(),date)) {
      Target target2=Target.all().filter("String_Node_Str" + "String_Node_Str" + "String_Node_Str",targetConfiguration.getUserInfo(),targetConfiguration.getTeam(),targetConfiguration.getPeriodTypeSelect(),targetConfiguration.getFromDate(),targetConfiguration.getToDate(),targetConfiguration.getCallEmittedNumber(),targetConfiguration.getMeetingNumber(),targetConfiguration.getOpportunityAmountEarned().doubleValue(),targetConfiguration.getOpportunityCreatedNumber(),targetConfiguration.getOpportunityCreatedWon()).fetchOne();
      if (target2 == null) {
        Target target=this.createTarget(targetConfiguration,oldDate,date.minusDays(1));
        this.update(target);
        oldDate=date;
      }
 else {
        throw new AxelorException(String.format("String_Node_Str",target2.getCode(),targetConfiguration.getCode()),IException.CONFIGURATION_ERROR);
      }
    }
  }
}

Fixed version (ground truth):
public void createsTargets(TargetConfiguration targetConfiguration) throws AxelorException {
  if (targetConfiguration.getPeriodTypeSelect() == ITarget.NONE) {
    Target target=this.createTarget(targetConfiguration,targetConfiguration.getFromDate(),targetConfiguration.getToDate());
    this.update(target);
  }
 else {
    LocalDate oldDate=targetConfiguration.getFromDate();
    for (LocalDate date=oldDate; date.isBefore(targetConfiguration.getToDate()) || date.isEqual(targetConfiguration.getToDate()); date=this.getNextDate(targetConfiguration.getPeriodTypeSelect(),date)) {
      Target target2=Target.all().filter("String_Node_Str" + "String_Node_Str" + "String_Node_Str",targetConfiguration.getUserInfo(),targetConfiguration.getTeam(),targetConfiguration.getPeriodTypeSelect(),targetConfiguration.getFromDate(),targetConfiguration.getToDate(),targetConfiguration.getCallEmittedNumber(),targetConfiguration.getMeetingNumber(),targetConfiguration.getOpportunityAmountWon().doubleValue(),targetConfiguration.getOpportunityCreatedNumber(),targetConfiguration.getOpportunityCreatedWon()).fetchOne();
      if (target2 == null) {
        Target target=this.createTarget(targetConfiguration,oldDate,date.minusDays(1));
        this.update(target);
        oldDate=date;
      }
 else {
        throw new AxelorException(String.format("String_Node_Str",target2.getCode(),targetConfiguration.getCode()),IException.CONFIGURATION_ERROR);
      }
    }
  }
}
Program: 59188
Project: 59188
Buggy source:
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public Target createTarget(TargetConfiguration targetConfiguration,LocalDate fromDate,LocalDate toDate){
  Target target=new Target();
  target.setCallEmittedNumberTarget(targetConfiguration.getCallEmittedNumber());
  target.setMeetingNumberTarget(targetConfiguration.getMeetingNumber());
  target.setOpportunityAmountEarnedTarget(targetConfiguration.getOpportunityAmountEarned());
  target.setOpportunityCreatedNumberTarget(target.getOpportunityCreatedNumberTarget());
  target.setOpportunityCreatedWonTarget(target.getOpportunityCreatedWonTarget());
  target.setPeriodTypeSelect(targetConfiguration.getPeriodTypeSelect());
  target.setFromDate(fromDate);
  target.setToDate(toDate);
  target.setUserInfo(targetConfiguration.getUserInfo());
  target.setTeam(targetConfiguration.getTeam());
  target.setName(targetConfiguration.getName());
  target.setCode(targetConfiguration.getCode());
  return target.save();
}

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public Target createTarget(TargetConfiguration targetConfiguration,LocalDate fromDate,LocalDate toDate){
  Target target=new Target();
  target.setCallEmittedNumberTarget(targetConfiguration.getCallEmittedNumber());
  target.setMeetingNumberTarget(targetConfiguration.getMeetingNumber());
  target.setOpportunityAmountWonTarget(targetConfiguration.getOpportunityAmountWon());
  target.setOpportunityCreatedNumberTarget(target.getOpportunityCreatedNumberTarget());
  target.setOpportunityCreatedWonTarget(target.getOpportunityCreatedWonTarget());
  target.setPeriodTypeSelect(targetConfiguration.getPeriodTypeSelect());
  target.setFromDate(fromDate);
  target.setToDate(toDate);
  target.setUserInfo(targetConfiguration.getUserInfo());
  target.setTeam(targetConfiguration.getTeam());
  target.setName(targetConfiguration.getName());
  target.setCode(targetConfiguration.getCode());
  return target.save();
}
Program: 59189
Project: 59189
Buggy source:
public void update(ActionRequest request,ActionResponse response){
  Target target=request.getContext().asType(Target.class);
  try {
    targetService.update(Target.find(target.getId()));
    response.setValue("String_Node_Str",target.getOpportunityAmountEarned());
    response.setValue("String_Node_Str",target.getOpportunityCreatedNumber());
    response.setValue("String_Node_Str",target.getOpportunityCreatedWon());
    response.setValue("String_Node_Str",target.getCallEmittedNumber());
    response.setValue("String_Node_Str",target.getMeetingNumber());
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
public void update(ActionRequest request,ActionResponse response){
  Target target=request.getContext().asType(Target.class);
  try {
    targetService.update(Target.find(target.getId()));
    response.setValue("String_Node_Str",target.getOpportunityAmountWon());
    response.setValue("String_Node_Str",target.getOpportunityCreatedNumber());
    response.setValue("String_Node_Str",target.getOpportunityCreatedWon());
    response.setValue("String_Node_Str",target.getCallEmittedNumber());
    response.setValue("String_Node_Str",target.getMeetingNumber());
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}
Program: 59190
Project: 59190
Buggy source:
/** 
 * Fonction permettant de calculer le solde exigible d'un contrat Calcul du solde exigible du contrat : Montant Total des échéances (des factures et des échéanciers) échues (date du jour >= date de l’échéance) - Montant Total payé sur l’échéancier
 * @param contractLine Un contrat
 * @return Le solde exigible
 */
public BigDecimal getBalanceDue(Partner partner,Company company){
  LOG.debug("String_Node_Str");
  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"+ "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,today.toDate(),TemporalType.DATE).setParameter(2,partner).setParameter(3,company);
  BigDecimal balance=(BigDecimal)query.getSingleResult();
  if (balance == null) {
    balance=BigDecimal.ZERO;
  }
  LOG.debug("String_Node_Str",balance);
  LOG.debug("String_Node_Str");
  return balance;
}

Fixed version (ground truth):
/** 
 * Fonction permettant de calculer le solde exigible d'un contrat Calcul du solde exigible du contrat : Montant Total des échéances (des factures et des échéanciers) échues (date du jour >= date de l’échéance) - Montant Total payé sur l’échéancier
 * @param contractLine Un contrat
 * @return Le solde exigible
 */
public BigDecimal getBalanceDue(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"+ "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,today.toDate(),TemporalType.DATE).setParameter(2,partner).setParameter(3,company);
  BigDecimal balance=(BigDecimal)query.getSingleResult();
  if (balance == null) {
    balance=BigDecimal.ZERO;
  }
  LOG.debug("String_Node_Str",balance);
  return balance;
}
Program: 59191
Project: 59191
Buggy source:
@Transactional public AccountingSituation updateAccountingSituationCustomerAccount(AccountingSituation accountingSituation,boolean updateCustAccount,boolean updateDueCustAccount,boolean updateDueReminderCustAccount){
  Partner partner=accountingSituation.getPartner();
  Company company=accountingSituation.getCompany();
  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);
  accountingSituation.save();
  return accountingSituation;
}

Fixed version (ground truth):
@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);
  accountingSituation.save();
  return accountingSituation;
}
Program: 59192
Project: 59192
Buggy source:
/** 
 * Fonction permettant de calculer le solde total d'un contrat
 * @param contractLine Un contrat
 * @return Le solde total
 */
public BigDecimal getBalance(Partner partner,Company company){
  LOG.debug("String_Node_Str");
  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);
  BigDecimal balance=(BigDecimal)query.getSingleResult();
  if (balance == null) {
    balance=BigDecimal.ZERO;
  }
  LOG.debug("String_Node_Str",balance);
  LOG.debug("String_Node_Str");
  return balance;
}

Fixed version (ground truth):
/** 
 * Fonction permettant de calculer le solde total d'un contrat
 * @param contractLine Un contrat
 * @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);
  BigDecimal balance=(BigDecimal)query.getSingleResult();
  if (balance == null) {
    balance=BigDecimal.ZERO;
  }
  LOG.debug("String_Node_Str",balance);
  return balance;
}
Program: 59193
Project: 59193
Buggy source:
/** 
 * solde des échéanciers dont le type est non contentieux et qui ne sont pas bloqués 
 */
public BigDecimal getBalanceDueReminder(Partner partner,Company company){
  LOG.debug("String_Node_Str");
  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"+ "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,company.getMailTransitTime()).setParameter(2,today.toDate(),TemporalType.DATE).setParameter(3,partner).setParameter(4,company);
  BigDecimal balance=(BigDecimal)query.getSingleResult();
  if (balance == null) {
    balance=BigDecimal.ZERO;
  }
  LOG.debug("String_Node_Str",balance);
  LOG.debug("String_Node_Str");
  return balance;
}

Fixed version (ground truth):
/** 
 * solde des échéanciers dont le type est non contentieux et qui ne sont pas bloqués 
 */
public BigDecimal getBalanceDueReminder(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"+ "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,company.getMailTransitTime()).setParameter(2,today.toDate(),TemporalType.DATE).setParameter(3,partner).setParameter(4,company);
  BigDecimal balance=(BigDecimal)query.getSingleResult();
  if (balance == null) {
    balance=BigDecimal.ZERO;
  }
  LOG.debug("String_Node_Str",balance);
  return balance;
}
Program: 59194
Project: 59194
Buggy source:
public void createsTargets(TargetConfiguration targetConfiguration) throws AxelorException {
  LocalDate oldDate=targetConfiguration.getFromDate();
  for (LocalDate date=oldDate; date.isBefore(targetConfiguration.getToDate()) || date.isEqual(targetConfiguration.getToDate()); date=this.getNextDate(targetConfiguration.getPeriodTypeSelect(),date)) {
    Target target2=Target.all().filter("String_Node_Str" + "String_Node_Str" + "String_Node_Str",targetConfiguration.getUserInfo(),targetConfiguration.getTeam(),targetConfiguration.getPeriodTypeSelect(),targetConfiguration.getFromDate(),targetConfiguration.getToDate(),targetConfiguration.getCallEmittedNumber(),targetConfiguration.getMeetingNumber(),targetConfiguration.getOpportunityAmountEarned().doubleValue(),targetConfiguration.getOpportunityCreatedNumber(),targetConfiguration.getOpportunityCreatedWon()).fetchOne();
    if (target2 == null) {
      Target target=this.createTarget(targetConfiguration,oldDate,date.minusDays(1));
      this.update(target);
      oldDate=date;
    }
 else {
      throw new AxelorException(String.format("String_Node_Str",target2.getCode(),targetConfiguration.getCode()),IException.CONFIGURATION_ERROR);
    }
  }
}

Fixed version (ground truth):
public void createsTargets(TargetConfiguration targetConfiguration) throws AxelorException {
  if (targetConfiguration.getPeriodTypeSelect() == ITarget.NONE) {
    Target target=this.createTarget(targetConfiguration,targetConfiguration.getFromDate(),targetConfiguration.getToDate());
    this.update(target);
  }
 else {
    LocalDate oldDate=targetConfiguration.getFromDate();
    for (LocalDate date=oldDate; date.isBefore(targetConfiguration.getToDate()) || date.isEqual(targetConfiguration.getToDate()); date=this.getNextDate(targetConfiguration.getPeriodTypeSelect(),date)) {
      Target target2=Target.all().filter("String_Node_Str" + "String_Node_Str" + "String_Node_Str",targetConfiguration.getUserInfo(),targetConfiguration.getTeam(),targetConfiguration.getPeriodTypeSelect(),targetConfiguration.getFromDate(),targetConfiguration.getToDate(),targetConfiguration.getCallEmittedNumber(),targetConfiguration.getMeetingNumber(),targetConfiguration.getOpportunityAmountEarned().doubleValue(),targetConfiguration.getOpportunityCreatedNumber(),targetConfiguration.getOpportunityCreatedWon()).fetchOne();
      if (target2 == null) {
        Target target=this.createTarget(targetConfiguration,oldDate,date.minusDays(1));
        this.update(target);
        oldDate=date;
      }
 else {
        throw new AxelorException(String.format("String_Node_Str",target2.getCode(),targetConfiguration.getCode()),IException.CONFIGURATION_ERROR);
      }
    }
  }
}
Program: 59195
Project: 59195
Buggy source:
public void update(ActionRequest request,ActionResponse response){
  Target target=request.getContext().asType(Target.class);
  try {
    targetService.update(target);
    response.setValue("String_Node_Str",target.getOpportunityAmountEarned());
    response.setValue("String_Node_Str",target.getOpportunityCreatedNumber());
    response.setValue("String_Node_Str",target.getOpportunityCreatedWon());
    response.setValue("String_Node_Str",target.getCallEmittedNumber());
    response.setValue("String_Node_Str",target.getMeetingNumber());
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
public void update(ActionRequest request,ActionResponse response){
  Target target=request.getContext().asType(Target.class);
  try {
    targetService.update(Target.find(target.getId()));
    response.setValue("String_Node_Str",target.getOpportunityAmountEarned());
    response.setValue("String_Node_Str",target.getOpportunityCreatedNumber());
    response.setValue("String_Node_Str",target.getOpportunityCreatedWon());
    response.setValue("String_Node_Str",target.getCallEmittedNumber());
    response.setValue("String_Node_Str",target.getMeetingNumber());
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}
Program: 59196
Project: 59196
Buggy source:
@Inject private GeneralService(){
  try {
    administrationId=General.all().fetchOne().getId();
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Inject private GeneralService(){
  General general=General.all().fetchOne();
  if (general != null) {
    administrationId=General.all().fetchOne().getId();
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 59198
Project: 59198
Buggy source:
public void createsTargets(TargetConfiguration targetConfiguration) throws AxelorException {
  LocalDate oldDate=targetConfiguration.getFromDate();
  for (LocalDate date=oldDate; date.isBefore(targetConfiguration.getToDate()) || date.isEqual(targetConfiguration.getToDate()); date=this.getNextDate(targetConfiguration.getPeriodTypeSelect(),date)) {
    Target target2=Target.all().filter("String_Node_Str" + "String_Node_Str" + "String_Node_Str",targetConfiguration.getUserInfo(),targetConfiguration.getTeam(),targetConfiguration.getPeriodTypeSelect(),targetConfiguration.getFromDate(),targetConfiguration.getToDate(),targetConfiguration.getCallEmittedNumber(),targetConfiguration.getMeetingNumber(),targetConfiguration.getOpportunityAmountEarned().doubleValue(),targetConfiguration.getOpportunityCreatedNumber(),targetConfiguration.getOpportunityCreatedWon()).fetchOne();
    if (target2 == null) {
      Target target=this.createTarget(targetConfiguration,oldDate.plusDays(1),date);
      this.update(target);
      oldDate=date;
    }
 else {
      throw new AxelorException(String.format("String_Node_Str",target2.getCode(),targetConfiguration.getCode()),IException.CONFIGURATION_ERROR);
    }
  }
}

Fixed version (ground truth):
public void createsTargets(TargetConfiguration targetConfiguration) throws AxelorException {
  LocalDate oldDate=targetConfiguration.getFromDate();
  for (LocalDate date=oldDate; date.isBefore(targetConfiguration.getToDate()) || date.isEqual(targetConfiguration.getToDate()); date=this.getNextDate(targetConfiguration.getPeriodTypeSelect(),date)) {
    Target target2=Target.all().filter("String_Node_Str" + "String_Node_Str" + "String_Node_Str",targetConfiguration.getUserInfo(),targetConfiguration.getTeam(),targetConfiguration.getPeriodTypeSelect(),targetConfiguration.getFromDate(),targetConfiguration.getToDate(),targetConfiguration.getCallEmittedNumber(),targetConfiguration.getMeetingNumber(),targetConfiguration.getOpportunityAmountEarned().doubleValue(),targetConfiguration.getOpportunityCreatedNumber(),targetConfiguration.getOpportunityCreatedWon()).fetchOne();
    if (target2 == null) {
      Target target=this.createTarget(targetConfiguration,oldDate,date.minusDays(1));
      this.update(target);
      oldDate=date;
    }
 else {
      throw new AxelorException(String.format("String_Node_Str",target2.getCode(),targetConfiguration.getCode()),IException.CONFIGURATION_ERROR);
    }
  }
}
Program: 59200
Project: 59200
Buggy source:
public ProductVariant createProductVariant(ProductVariantAttribute productVariantAttribute1,ProductVariantAttribute productVariantAttribute2,ProductVariantAttribute productVariantAttribute3,ProductVariantAttribute productVariantAttribute4,ProductVariantValue productVariantValue1,ProductVariantValue productVariantValue2,ProductVariantValue productVariantValue3,ProductVariantValue productVariantValue4,boolean usedForStock){
  ProductVariant productVariant=new ProductVariant();
  productVariant.setProductVariantAttribute1(productVariantAttribute1);
  productVariant.setProductVariantAttribute2(productVariantAttribute2);
  productVariant.setProductVariantAttribute3(productVariantAttribute3);
  productVariant.setProductVariantAttribute4(productVariantAttribute4);
  productVariant.setProductVariantValue1(productVariantValue1);
  productVariant.setProductVariantValue2(productVariantValue2);
  productVariant.setProductVariantValue3(productVariantValue3);
  productVariant.setProductVariantValue4(productVariantValue4);
  productVariant.setUsedforStock(usedForStock);
  return productVariant;
}

Fixed version (ground truth):
public ProductVariant createProductVariant(ProductVariantAttribute productVariantAttribute1,ProductVariantAttribute productVariantAttribute2,ProductVariantAttribute productVariantAttribute3,ProductVariantAttribute productVariantAttribute4,ProductVariantValue productVariantValue1,ProductVariantValue productVariantValue2,ProductVariantValue productVariantValue3,ProductVariantValue productVariantValue4,boolean usedForStock){
  ProductVariant productVariant=new ProductVariant();
  productVariant.setProductVariantAttribute1(productVariantAttribute1);
  productVariant.setProductVariantAttribute2(productVariantAttribute2);
  productVariant.setProductVariantAttribute3(productVariantAttribute3);
  productVariant.setProductVariantAttribute4(productVariantAttribute4);
  productVariant.setProductVariantValue1(productVariantValue1);
  productVariant.setProductVariantValue2(productVariantValue2);
  productVariant.setProductVariantValue3(productVariantValue3);
  productVariant.setProductVariantValue4(productVariantValue4);
  productVariant.setUsedForStock(usedForStock);
  return productVariant;
}
Program: 59202
Project: 59202
Buggy source:
/** 
 * Create a partner from a lead
 * @param lead
 * @return
 * @throws AxelorException
 */
public Partner createPartner(Partner context) throws AxelorException {
  Partner partner=new Partner();
  if (context != null) {
    LOG.debug("String_Node_Str" + context);
    LOG.debug("String_Node_Str" + context.getPartnerTypeSelect());
    partner.setFirstName(context.getFirstName());
    partner.setName(context.getName());
    partner.setTitleSelect(context.getTitleSelect());
    partner.setCustomerTypeSelect(context.getCustomerTypeSelect());
    partner.setPartnerTypeSelect(context.getPartnerTypeSelect());
    partner.setIsContact(context.getIsContact());
    partner.setEmail(context.getEmail());
    partner.setFax(context.getFax());
    partner.setWebSite(context.getWebSite());
    partner.setMobilePhonePro(context.getMobilePhonePro());
    partner.setSource(context.getSource());
    partner.setDepartment(context.getDepartment());
    partner.setPicture(context.getPicture());
    partner.setBankDetails(context.getBankDetails());
    partner.setPartnerSeq(leadService.getSequence());
  }
  return partner;
}

Fixed version (ground truth):
public Partner createPartner(Map<String,Object> context) throws AxelorException {
  Mapper mapper=Mapper.of(Partner.class);
  Partner partner=Mapper.toBean(Partner.class,null);
  partner=(Partner)this.createObject(context,partner,mapper);
  partner.setPartnerSeq(leadService.getSequence());
  return partner;
}
Program: 59203
Project: 59203
Buggy source:
/** 
 * Create an event from a lead (Call or Meeting)
 * @param lead
 * @return
 * @throws AxelorException
 */
public Event createEvent(Event context,int type) throws AxelorException {
  if (context != null) {
    Event event=new Event();
    event.setDescription(context.getDescription());
    event.setDurationHours(context.getDurationHours());
    event.setDurationMinutesSelect(context.getDurationMinutesSelect());
    event.setEndDateTime(context.getEndDateTime());
    event.setEventCategory(context.getEventCategory());
    event.setIsTimesheetAffected(context.getIsTimesheetAffected());
    event.setLocation(context.getLocation());
    event.setMeetingType(context.getMeetingType());
    event.setPrioritySelect(context.getPrioritySelect());
    event.setProgressSelect(context.getProgressSelect());
    event.setProject(context.getProject());
    event.setRelatedToSelect(context.getRelatedToSelect());
    event.setRelatedToSelectId(context.getRelatedToSelectId());
    event.setReminder(context.getReminder());
    event.setResponsibleUserInfo(context.getResponsibleUserInfo());
    event.setStartDateTime(context.getStartDateTime());
    event.setSubject(context.getSubject());
    event.setTask(context.getTask());
    event.setTaskPartner(context.getTaskPartner());
    event.setTeam(context.getTeam());
    event.setTicketNumberSeq(context.getTicketNumberSeq());
    event.setTypeSelect(context.getTypeSelect());
    event.setUserInfo(context.getUserInfo());
    event.setTypeSelect(type);
    return event;
  }
  return null;
}

Fixed version (ground truth):
public Event createEvent(Map<String,Object> context,int type) throws AxelorException {
  Mapper mapper=Mapper.of(Event.class);
  Event event=Mapper.toBean(Event.class,null);
  event=(Event)this.createObject(context,event,mapper);
  event.setTypeSelect(type);
  return event;
}
Program: 59204
Project: 59204
Buggy source:
/** 
 * Create an opportunity from a lead
 * @param lead
 * @return
 * @throws AxelorException
 */
public Opportunity createOpportunity(Opportunity context) throws AxelorException {
  if (context != null) {
    Opportunity opportunity=new Opportunity();
    opportunity.setAmount(context.getAmount());
    opportunity.setCampaign(context.getCampaign());
    opportunity.setCompany(context.getCompany());
    opportunity.setBestCase(context.getBestCase());
    opportunity.setCurrency(context.getCurrency());
    opportunity.setDescription(context.getDescription());
    opportunity.setExpectedCloseDate(context.getExpectedCloseDate());
    opportunity.setName(context.getName());
    opportunity.setNextStep(context.getNextStep());
    opportunity.setOpportunityType(context.getOpportunityType());
    opportunity.setPartner(context.getPartner());
    opportunity.setProbability(context.getProbability());
    opportunity.setSalesStageSelect(context.getSalesStageSelect());
    opportunity.setSource(context.getSource());
    opportunity.setTeam(context.getTeam());
    opportunity.setUserInfo(context.getUserInfo());
    opportunity.setWorstCase(context.getWorstCase());
    return opportunity;
  }
  return null;
}

Fixed version (ground truth):
public Opportunity createOpportunity(Map<String,Object> context) throws AxelorException {
  Mapper mapper=Mapper.of(Opportunity.class);
  Opportunity opportunity=Mapper.toBean(Opportunity.class,null);
  opportunity=(Opportunity)this.createObject(context,opportunity,mapper);
  return opportunity;
}
Program: 59206
Project: 59206
Buggy source:
public void checkDate(ActionRequest request,ActionResponse response){
  CurrencyConversionLine ccl=request.getContext().asType(CurrencyConversionLine.class);
  if (CurrencyConversionLine.all().filter("String_Node_Str",ccl.getStartCurrency(),ccl.getEndCurrency()).count() > 0) {
    String msg="String_Node_Str";
    response.setFlash(msg);
    response.setValue("String_Node_Str","String_Node_Str");
  }
 else   if (CurrencyConversionLine.all().filter("String_Node_Str",ccl.getStartCurrency(),ccl.getEndCurrency(),ccl.getFromDate()).count() > 0) {
    String msg="String_Node_Str";
    response.setFlash(msg);
    response.setValue("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
public void checkDate(ActionRequest request,ActionResponse response){
  CurrencyConversionLine ccl=request.getContext().asType(CurrencyConversionLine.class);
  if (CurrencyConversionLine.all().filter("String_Node_Str",ccl.getStartCurrency(),ccl.getEndCurrency()).count() > 0) {
    String msg="String_Node_Str";
    response.setFlash(msg);
    response.setValue("String_Node_Str","String_Node_Str");
  }
 else   if (CurrencyConversionLine.all().filter("String_Node_Str",ccl.getStartCurrency(),ccl.getEndCurrency(),ccl.getFromDate()).count() > 0) {
    String msg="String_Node_Str";
    response.setFlash(msg);
  }
}
Program: 59207
Project: 59207
Buggy source:
public Object evaluate(String query,Model context){
  try {
    Class<?> klass=this.extractClass(query);
    System.err.println(klass);
    StringBuilder sb=new StringBuilder(query);
    int n=0, i=sb.indexOf("String_Node_Str");
    while (i > -1) {
      sb.replace(i,i + 1,"String_Node_Str" + (++n));
      i=sb.indexOf("String_Node_Str",i + 1);
    }
    TypedQuery<?> querie=JPA.em().createQuery(sb.toString(),klass);
    for (int j=1; j <= n; j++) {
      querie.setParameter(n,context);
    }
    return querie.getResultList();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public Object evaluate(String query,Model bean){
  try {
    Class<?> klass=this.extractClass(query);
    System.err.println(klass);
    StringBuilder sb=new StringBuilder(query);
    int n=0, i=sb.indexOf("String_Node_Str");
    while (i > -1) {
      sb.replace(i,i + 1,"String_Node_Str" + (++n));
      i=sb.indexOf("String_Node_Str",i + 1);
    }
    TypedQuery<?> querie=JPA.em().createQuery(sb.toString(),klass);
    for (int j=1; j <= n; j++) {
      querie.setParameter(n,bean);
    }
    return querie.getResultList();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  return null;
}
Program: 59208
Project: 59208
Buggy source:
public Map<String,Object> getContext(TemplateContext templateContext,Model context){
  Map<String,Object> map=Maps.newHashMap();
  if (templateContext.getTemplateContextLine() != null) {
    for (    TemplateContextLine line : templateContext.getTemplateContextLine()) {
      Object o=tcls.evaluate(line,context);
      map.put(line.getKey(),o);
    }
  }
  return map;
}

Fixed version (ground truth):
public Map<String,Object> getContext(TemplateContext templateContext,Model bean){
  Map<String,Object> map=Maps.newHashMap();
  if (templateContext.getTemplateContextLine() != null) {
    for (    TemplateContextLine line : templateContext.getTemplateContextLine()) {
      Object o=tcls.evaluate(line,bean);
      map.put(line.getKey(),o);
    }
  }
  return map;
}
Program: 59209
Project: 59209
Buggy source:
public Map<String,Object> getContext(Template template,Model context){
  if (template.getTemplateContext() == null) {
    return null;
  }
  return tcs.getContext(template.getTemplateContext(),context);
}

Fixed version (ground truth):
public Map<String,Object> getContext(Template template,Model bean){
  if (template.getTemplateContext() == null) {
    return null;
  }
  return tcs.getContext(template.getTemplateContext(),bean);
}