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 |
[ https://issues.apache.org/jira/browse/OFBIZ-4720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Shi Jinghai updated OFBIZ-4720: ------------------------------- Attachment: adjustmentPromoIndex.patch > 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 > Attachments: adjustmentPromoIndex.patch > > > 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 |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jacques Le Roux closed OFBIZ-4720. ---------------------------------- Resolution: Fixed Fix Version/s: SVN trunk Release Branch 11.04 Assignee: Jacques Le Roux Thanks Shi Jinghai, Your patch is in trunk at r1296875 R11.04 at r1296879 This has obviously never been tested. Incrementing a positive or 0 value with only a test on being > 0 can only end with and out of range index exception :/ > 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 > Assignee: Jacques Le Roux > Priority: Minor > Fix For: Release Branch 11.04, SVN trunk > > Attachments: adjustmentPromoIndex.patch > > > 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 |
Free forum by Nabble | Edit this page |