Program: 58465
Project: 58465
Buggy source:
public Map<String,Object> getDiscount(PurchaseOrder purchaseOrder,PurchaseOrderLine purchaseOrderLine,BigDecimal price){
  PriceList priceList=purchaseOrder.getPriceList();
  BigDecimal discountAmount=BigDecimal.ZERO;
  int computeMethodDiscountSelect=appBaseService.getAppBase().getComputeMethodDiscountSelect();
  Map<String,Object> discounts=null;
  if (priceList != null) {
    int discountTypeSelect=0;
    PriceListLine priceListLine=this.getPriceListLine(purchaseOrderLine,priceList);
    if (priceListLine != null) {
      discountTypeSelect=priceListLine.getTypeSelect();
    }
    discounts=priceListService.getDiscounts(priceList,priceListLine,price);
    discountAmount=(BigDecimal)discounts.get("String_Node_Str");
    if ((computeMethodDiscountSelect == AppBaseRepository.INCLUDE_DISCOUNT_REPLACE_ONLY && discountTypeSelect == PriceListLineRepository.TYPE_REPLACE) || computeMethodDiscountSelect == AppBaseRepository.INCLUDE_DISCOUNT) {
      discounts.put("String_Node_Str",priceListService.computeDiscount(price,(int)discounts.get("String_Node_Str"),discountAmount));
    }
  }
  if (discountAmount.compareTo(BigDecimal.ZERO) == 0) {
    List<SupplierCatalog> supplierCatalogList=purchaseOrderLine.getProduct().getSupplierCatalogList();
    if (supplierCatalogList != null && !supplierCatalogList.isEmpty()) {
      SupplierCatalog supplierCatalog=Beans.get(SupplierCatalogRepository.class).all().filter("String_Node_Str",purchaseOrderLine.getProduct(),purchaseOrderLine.getQty(),purchaseOrder.getSupplierPartner()).fetchOne();
      if (supplierCatalog != null) {
        discounts=productService.getDiscountsFromCatalog(supplierCatalog,price);
        if (computeMethodDiscountSelect != AppBaseRepository.DISCOUNT_SEPARATE) {
          discounts.put("String_Node_Str",priceListService.computeDiscount(price,(int)discounts.get("String_Node_Str"),(BigDecimal)discounts.get("String_Node_Str")));
        }
      }
    }
  }
  return discounts;
}

Fixed version (ground truth):
public Map<String,Object> getDiscount(PurchaseOrder purchaseOrder,PurchaseOrderLine purchaseOrderLine,BigDecimal price){
  PriceList priceList=purchaseOrder.getPriceList();
  BigDecimal discountAmount=BigDecimal.ZERO;
  int computeMethodDiscountSelect=appBaseService.getAppBase().getComputeMethodDiscountSelect();
  Map<String,Object> discounts=null;
  if (priceList != null) {
    PriceListLine priceListLine=this.getPriceListLine(purchaseOrderLine,priceList);
    discounts=priceListService.getReplacedPriceAndDiscounts(priceList,priceListLine,price);
  }
  if (discountAmount.compareTo(BigDecimal.ZERO) == 0) {
    List<SupplierCatalog> supplierCatalogList=purchaseOrderLine.getProduct().getSupplierCatalogList();
    if (supplierCatalogList != null && !supplierCatalogList.isEmpty()) {
      SupplierCatalog supplierCatalog=Beans.get(SupplierCatalogRepository.class).all().filter("String_Node_Str",purchaseOrderLine.getProduct(),purchaseOrderLine.getQty(),purchaseOrder.getSupplierPartner()).fetchOne();
      if (supplierCatalog != null) {
        discounts=productService.getDiscountsFromCatalog(supplierCatalog,price);
        if (computeMethodDiscountSelect != AppBaseRepository.DISCOUNT_SEPARATE) {
          discounts.put("String_Node_Str",priceListService.computeDiscount(price,(int)discounts.get("String_Node_Str"),(BigDecimal)discounts.get("String_Node_Str")));
        }
      }
    }
  }
  return discounts;
}