[
https://issues.apache.org/jira/browse/OFBIZ-9778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Leichert updated OFBIZ-9778:
-----------------------------------
Attachment: OFBIZ-9778_org.apache.ofbiz.product.inventory_bugfixes.patch
class InventoryServices
- removed redundant null-checks
- added necessary null-check
> [FB] Package org.apache.ofbiz.product.inventory
> -----------------------------------------------
>
> Key: OFBIZ-9778
> URL: https://issues.apache.org/jira/browse/OFBIZ-9778
> Project: OFBiz
> Issue Type: Sub-task
> Components: product
> Affects Versions: Trunk
> Reporter: Julian Leichert
> Priority: Minor
> Attachments:
> OFBIZ-9778_org.apache.ofbiz.product.inventory_bugfixes.patch
>
>
> InventoryServices.java:229, RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
> - RCN: Nullcheck of inventoryTransfer at line 229 of value previously
> dereferenced in
> org.apache.ofbiz.product.inventory.InventoryServices.completeInventoryTransfer(DispatchContext,
> Map)
> A value is checked here to see whether it is null, but this value can't be
> null because it was previously dereferenced and if it were null a null
> pointer exception would have occurred at the earlier dereference.
> Essentially, this code and the previous dereference disagree as to whether
> this value is allowed to be null. Either the check is redundant or the
> previous dereference is erroneous.
> InventoryServices.java:346, RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
> - RCN: Nullcheck of inventoryTransfer at line 346 of value previously
> dereferenced in
> org.apache.ofbiz.product.inventory.InventoryServices.cancelInventoryTransfer(DispatchContext,
> Map)
> A value is checked here to see whether it is null, but this value can't be
> null because it was previously dereferenced and if it were null a null
> pointer exception would have occurred at the earlier dereference.
> Essentially, this code and the previous dereference disagree as to whether
> this value is allowed to be null. Either the check is redundant or the
> previous dereference is erroneous.
> InventoryServices.java:591, RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
> - RCN: Nullcheck of orderItemShipGroup at line 591 of value previously
> dereferenced in
> org.apache.ofbiz.product.inventory.InventoryServices.checkInventoryAvailability(DispatchContext,
> Map)
> A value is checked here to see whether it is null, but this value can't be
> null because it was previously dereferenced and if it were null a null
> pointer exception would have occurred at the earlier dereference.
> Essentially, this code and the previous dereference disagree as to whether
> this value is allowed to be null. Either the check is redundant or the
> previous dereference is erroneous.
> InventoryServices.java:622, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
> - RCN: Redundant nullcheck of orderItems, which is known to be non-null in
> org.apache.ofbiz.product.inventory.InventoryServices.checkInventoryAvailability(DispatchContext,
> Map)
> This method contains a redundant check of a known non-null value against the
> constant null.
> InventoryServices.java:863, NP_NULL_ON_SOME_PATH_EXCEPTION
> - NP: Possible null pointer dereference of product in
> org.apache.ofbiz.product.inventory.InventoryServices.getProductInventoryAndFacilitySummary(DispatchContext,
> Map) on exception path
> A reference value which is null on some exception control path is
> dereferenced here. This may lead to a NullPointerException when the code is
> executed. Note that because FindBugs currently does not prune infeasible
> exception paths, this may be a false warning.
> Also note that FindBugs considers the default case of a switch statement to
> be an exception path, since the default case is often infeasible.
> InventoryServices.java:905, NP_NULL_ON_SOME_PATH_EXCEPTION
> - NP: Possible null pointer dereference of productPrices in
> org.apache.ofbiz.product.inventory.InventoryServices.getProductInventoryAndFacilitySummary(DispatchContext,
> Map) on exception path
> A reference value which is null on some exception control path is
> dereferenced here. This may lead to a NullPointerException when the code is
> executed. Note that because FindBugs currently does not prune infeasible
> exception paths, this may be a false warning.
> Also note that FindBugs considers the default case of a switch statement to
> be an exception path, since the default case is often infeasible.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)