Program: 58903
Project: 58903
Buggy source:
public void getDiscount(ActionRequest request,ActionResponse response){
  SaleOrderLine saleOrderLine=request.getContext().asType(SaleOrderLine.class);
  SaleOrder saleOrder=saleOrderLine.getSaleOrder();
  if (saleOrder == null) {
    saleOrder=request.getContext().getParentContext().asType(SaleOrder.class);
  }
  if (saleOrder != null && saleOrderLine.getProduct() != null) {
    try {
      BigDecimal price=saleOrderLine.getPrice();
      if (price.compareTo(BigDecimal.ZERO) == 0) {
        price=saleOrderLine.getProduct().getSalePrice();
      }
      PriceList priceList=saleOrder.getPriceList();
      int discountTypeSelect=0;
      if (priceList != null) {
        PriceListLine priceListLine=saleOrderLineService.getPriceListLine(saleOrderLine,priceList);
        if (priceListLine != null) {
          discountTypeSelect=priceListLine.getTypeSelect();
        }
        if ((GeneralService.getGeneral().getComputeMethodDiscountSelect() == GeneralRepository.INCLUDE_DISCOUNT_REPLACE_ONLY && discountTypeSelect == IPriceListLine.TYPE_REPLACE) || GeneralService.getGeneral().getComputeMethodDiscountSelect() == GeneralRepository.INCLUDE_DISCOUNT) {
          Map<String,Object> discounts=priceListService.getDiscounts(priceList,priceListLine,price);
          price=priceListService.computeDiscount(price,(int)discounts.get("String_Node_Str"),(BigDecimal)discounts.get("String_Node_Str"));
        }
 else {
          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());
    }
  }
}

Fixed version (ground truth):
public void getDiscount(ActionRequest request,ActionResponse response){
  SaleOrderLine saleOrderLine=request.getContext().asType(SaleOrderLine.class);
  SaleOrder saleOrder=saleOrderLine.getSaleOrder();
  if (saleOrder == null) {
    saleOrder=request.getContext().getParentContext().asType(SaleOrder.class);
  }
  if (saleOrder != null && saleOrderLine.getProduct() != null) {
    try {
      BigDecimal price=saleOrderLine.getPrice();
      PriceList priceList=saleOrder.getPriceList();
      int discountTypeSelect=0;
      if (priceList != null) {
        PriceListLine priceListLine=saleOrderLineService.getPriceListLine(saleOrderLine,priceList);
        if (priceListLine != null) {
          discountTypeSelect=priceListLine.getTypeSelect();
        }
        if ((GeneralService.getGeneral().getComputeMethodDiscountSelect() == GeneralRepository.INCLUDE_DISCOUNT_REPLACE_ONLY && discountTypeSelect == IPriceListLine.TYPE_REPLACE) || GeneralService.getGeneral().getComputeMethodDiscountSelect() == GeneralRepository.INCLUDE_DISCOUNT) {
          Map<String,Object> discounts=priceListService.getDiscounts(priceList,priceListLine,price);
          price=priceListService.computeDiscount(price,(int)discounts.get("String_Node_Str"),(BigDecimal)discounts.get("String_Node_Str"));
        }
 else {
          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());
    }
  }
}