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.

Reply via email to