loadCartFromOrder assumes service call is successful
---------------------------------------------------- Key: OFBIZ-2782 URL: https://issues.apache.org/jira/browse/OFBIZ-2782 Project: OFBiz Issue Type: Bug Components: order Affects Versions: SVN trunk Reporter: Bob Morley Attachments: loaderrorhandling.diff In ShoppingCartEvents.loadCartfromOrder a call to a service named "loadCartFromOrder" is performed. If this service results in an error (but does not throw an exception) the system will retrieve a null ShoppingCart object and ultimately fail with a null reference exception. The simple change is to check that the service call was successful -- if it is not successful, the event sets the error message (from the service error message) and returns an error. A patch file will be attached with the fix. *Note* I had added a helper function to ServiceUtil called "isSuccess" which is used here as well. This removes the need for the "if (error || failure)" pattern that is pretty pervasive in the code. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
[ https://issues.apache.org/jira/browse/OFBIZ-2782?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bob Morley updated OFBIZ-2782: ------------------------------ Attachment: loaderrorhandling.diff > loadCartFromOrder assumes service call is successful > ---------------------------------------------------- > > Key: OFBIZ-2782 > URL: https://issues.apache.org/jira/browse/OFBIZ-2782 > Project: OFBiz > Issue Type: Bug > Components: order > Affects Versions: SVN trunk > Reporter: Bob Morley > Attachments: loaderrorhandling.diff > > > In ShoppingCartEvents.loadCartfromOrder a call to a service named "loadCartFromOrder" is performed. If this service results in an error (but does not throw an exception) the system will retrieve a null ShoppingCart object and ultimately fail with a null reference exception. > The simple change is to check that the service call was successful -- if it is not successful, the event sets the error message (from the service error message) and returns an error. A patch file will be attached with the fix. > *Note* I had added a helper function to ServiceUtil called "isSuccess" which is used here as well. This removes the need for the "if (error || failure)" pattern that is pretty pervasive in the code. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-2782?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jacques Le Roux closed OFBIZ-2782. ---------------------------------- Resolution: Fixed Fix Version/s: SVN trunk Release Branch 9.04 Assignee: Jacques Le Roux Thanks Bob, Your patch is in trunk at r810921, R9.04 at r810922. > loadCartFromOrder assumes service call is successful > ---------------------------------------------------- > > Key: OFBIZ-2782 > URL: https://issues.apache.org/jira/browse/OFBIZ-2782 > Project: OFBiz > Issue Type: Bug > Components: order > Affects Versions: SVN trunk > Reporter: Bob Morley > Assignee: Jacques Le Roux > Fix For: Release Branch 9.04, SVN trunk > > Attachments: loaderrorhandling.diff > > > In ShoppingCartEvents.loadCartfromOrder a call to a service named "loadCartFromOrder" is performed. If this service results in an error (but does not throw an exception) the system will retrieve a null ShoppingCart object and ultimately fail with a null reference exception. > The simple change is to check that the service call was successful -- if it is not successful, the event sets the error message (from the service error message) and returns an error. A patch file will be attached with the fix. > *Note* I had added a helper function to ServiceUtil called "isSuccess" which is used here as well. This removes the need for the "if (error || failure)" pattern that is pretty pervasive in the code. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
Free forum by Nabble | Edit this page |