[ 
https://issues.apache.org/jira/browse/OFBIZ-576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12485772
 ] 

Chris Howe commented on OFBIZ-576:
----------------------------------

I have since fixed the database inconsistency  and no longer have the issue.  
However, it was an NPE

the code in question...
line 186 rev 522996
    // for each order item get the associated product
    GenericValue product = orderItem.getRelatedOneCache("Product");

    products.put(product.get("productId"), product);

when product = null then product.get("productId", null) evaluates to a NPE 
(which will occur if orderItem.productId = "xyz", but there is no product with 
productId "xyz" in the Product entity.)


Again, I'm not sure if it is possible to get orderItem.productId to = "xyz" but 
not have xyz in the Product entity through normal operations, so I'm not sure 
if it's necessary to protect this by doing the following...

    GenericValue product = orderItem.getRelatedOneCache("Product");
    try {
      products.put(product.get("productId"), product);
    } catch (NullPointerException npe) {
        Debug.logInfo("Product [" + orderItem.productId + "] does not exist, 
not adding to reorder list", module);
    }

or 

     GenericValue product = orderItem.getRelatedOneCache("Product");
     if (product!=null) products.put(product.get("productId"), product);




> ProductDisplayWorker.getQuickReorderProducts
> --------------------------------------------
>
>                 Key: OFBIZ-576
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-576
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Bug
>          Components: ecommerce
>            Reporter: Chris Howe
>            Priority: Minor
>
> Returns an error in log and doesn't paint the ecommerce screen: 
> minireorderproduct  when a productId doesn't return as expected.  

-- 
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