getAdjustmentPromoIndex(String productPromoId) in ShoppingCart.java
-------------------------------------------------------------------

                 Key: OFBIZ-4720
                 URL: https://issues.apache.org/jira/browse/OFBIZ-4720
             Project: OFBiz
          Issue Type: Bug
            Reporter: Shi Jinghai
            Priority: Minor


Currently this method throws an out of range index exception.

Original:
    public int getAdjustmentPromoIndex(String productPromoId) {
        int index = adjustments.size();
        while (index > 0) {
            if 
(adjustments.get(index).getString("productPromoId").equals(productPromoId)) {
                return(index);
            }
            index++;
        }
        return -1;
    }

Change to:
    public int getAdjustmentPromoIndex(String productPromoId) {
        int index = adjustments.size();
        while (index > 0) {
            index--;
            if 
(adjustments.get(index).getString("productPromoId").equals(productPromoId)) {
                return(index);
            }
        }
        return -1;
    }


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to