[ 
https://issues.apache.org/jira/browse/OFBIZ-9541?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Brohl reassigned OFBIZ-9541:
------------------------------------

    Assignee: Michael Brohl

> [FB] Package org.apache.ofbiz.accounting.invoice
> ------------------------------------------------
>
>                 Key: OFBIZ-9541
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9541
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: accounting
>    Affects Versions: Trunk
>            Reporter: Karsten Tymann
>            Assignee: Michael Brohl
>            Priority: Minor
>         Attachments: OFBIZ-number_FB_accounting_invoice.patch
>
>
> InvoiceServices.java:107, MS_SHOULD_BE_FINAL
> * MS: org.apache.ofbiz.accounting.invoice.InvoiceServices.module isn't final 
> but should be
> This static field public but not final, and could be changed by malicious 
> code or by accident from another package. The field could be made final to 
> avoid this vulnerability.
> InvoiceServices.java:395, NP_NULL_ON_SOME_PATH_MIGHT_BE_INFEASIBLE
> * NP: Possible null pointer dereference of orderItem on branch that might be 
> infeasible in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.createInvoiceForOrder(DispatchContext,
>  Map)
> There is a branch of statement that, if executed, guarantees that a null 
> value will be dereferenced, which would generate a NullPointerException when 
> the code is executed. Of course, the problem might be that the branch or 
> statement is infeasible and that the null pointer exception can't ever be 
> executed; deciding that is beyond the ability of FindBugs. Due to the fact 
> that this value had been previously tested for nullness, this is a definite 
> possibility.
> InvoiceServices.java:764, WMI_WRONG_MAP_ITERATOR
> * WMI: 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.createInvoiceForOrder(DispatchContext,
>  Map) makes inefficient use of keySet iterator instead of entrySet iterator
> This method accesses the value of a Map entry, using a key that was retrieved 
> from a keySet iterator. It is more efficient to use an iterator on the 
> entrySet of the map, to avoid the Map.get(key) lookup.
> InvoiceServices.java:918, DLS_DEAD_LOCAL_STORE, Priorität: Normal
> * DLS: Dead store to billFromVendorInvoiceRoles in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.createCommissionInvoices(DispatchContext,
>  Map)
> This instruction assigns a value to a local variable, but the value is not 
> read or used in any subsequent instruction. Often, this indicates an error, 
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local 
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to 
> eliminate these false positives.
> InvoiceServices.java:919, DLS_DEAD_LOCAL_STORE
> * DLS: Dead store to invoiceItems in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.createCommissionInvoices(DispatchContext,
>  Map)
> This instruction assigns a value to a local variable, but the value is not 
> read or used in any subsequent instruction. Often, this indicates an error, 
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local 
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to 
> eliminate these false positives.
> InvoiceServices.java:960, DLS_DEAD_LOCAL_STORE
> * DLS: Dead store to quantity in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.createCommissionInvoices(DispatchContext,
>  Map)
> This instruction assigns a value to a local variable, but the value is not 
> read or used in any subsequent instruction. Often, this indicates an error, 
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local 
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to 
> eliminate these false positives.
> InvoiceServices.java:1038, NP_LOAD_OF_KNOWN_NULL_VALUE
> * NP: Load of known null value in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.createCommissionInvoices(DispatchContext,
>  Map)
> The variable referenced at this point is known to be null due to an earlier 
> check against null. Although this is valid, it might be a mistake (perhaps 
> you intended to refer to a different variable, or perhaps the earlier check 
> to see if the variable is null should have been a check to see if it was 
> non-null).
> InvoiceServices.java:1154, DLS_DEAD_LOCAL_STORE
> * DLS: Dead store to invoicesCreated in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.createInvoicesFromShipment(DispatchContext,
>  Map)
> This instruction assigns a value to a local variable, but the value is not 
> read or used in any subsequent instruction. Often, this indicates an error, 
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local 
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to 
> eliminate these false positives.
> InvoiceServices.java:1222, DLS_DEAD_LOCAL_STORE
> * DLS: Dead store to itemIssuances in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.setInvoicesToReadyFromShipment(DispatchContext,
>  Map)
> This instruction assigns a value to a local variable, but the value is not 
> read or used in any subsequent instruction. Often, this indicates an error, 
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local 
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to 
> eliminate these false positives.
> InvoiceServices.java:1275, DLS_DEAD_LOCAL_STORE
> * DLS: Dead store to setInvoiceStatusResult in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.setInvoicesToReadyFromShipment(DispatchContext,
>  Map)
> This instruction assigns a value to a local variable, but the value is not 
> read or used in any subsequent instruction. Often, this indicates an error, 
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local 
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to 
> eliminate these false positives.
> InvoiceServices.java:1455, WMI_WRONG_MAP_ITERATOR
> * WMI: 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.createInvoicesFromShipments(DispatchContext,
>  Map) makes inefficient use of keySet iterator instead of entrySet iterator
> This method accesses the value of a Map entry, using a key that was retrieved 
> from a keySet iterator. It is more efficient to use an iterator on the 
> entrySet of the map, to avoid the Map.get(key) lookup.
> InvoiceServices.java:1533, NP_NULL_PARAM_DEREF
> * NP: Null passed for nonnull parameter of 
> java.math.BigDecimal.subtract(BigDecimal) in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.createInvoicesFromShipments(DispatchContext,
>  Map)
> This method call passes a null value for a non-null method parameter. Either 
> the parameter is annotated as a parameter that should always be non-null, or 
> analysis has shown that it will always be dereferenced.
> InvoiceServices.java:2630, NP_NULL_ON_SOME_PATH
> * NP: Possible null pointer dereference of payment in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.updatePaymentApplicationDefBd(DispatchContext,
>  Map)
> There is a branch of statement that, if executed, guarantees that a null 
> value will be dereferenced, which would generate a NullPointerException when 
> the code is executed. Of course, the problem might be that the branch or 
> statement is infeasible and that the null pointer exception can't ever be 
> executed; deciding that is beyond the ability of FindBugs.
> InvoiceServices.java:2664, NP_NULL_ON_SOME_PATH
> * NP: Possible null pointer dereference of toPayment in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.updatePaymentApplicationDefBd(DispatchContext,
>  Map)
> There is a branch of statement that, if executed, guarantees that a null 
> value will be dereferenced, which would generate a NullPointerException when 
> the code is executed. Of course, the problem might be that the branch or 
> statement is infeasible and that the null pointer exception can't ever be 
> executed; deciding that is beyond the ability of FindBugs.
> InvoiceServices.java:2740, NP_NULL_ON_SOME_PATH
> * NP: Possible null pointer dereference of billingAccount in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.updatePaymentApplicationDefBd(DispatchContext,
>  Map)
> There is a branch of statement that, if executed, guarantees that a null 
> value will be dereferenced, which would generate a NullPointerException when 
> the code is executed. Of course, the problem might be that the branch or 
> statement is infeasible and that the null pointer exception can't ever be 
> executed; deciding that is beyond the ability of FindBugs.
> InvoiceServices.java:2802, DLS_DEAD_LOCAL_STORE
> * DLS: Dead store to amountAppliedMax in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.updatePaymentApplicationDefBd(DispatchContext,
>  Map)
> This instruction assigns a value to a local variable, but the value is not 
> read or used in any subsequent instruction. Often, this indicates an error, 
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local 
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to 
> eliminate these false positives.
> InvoiceServices.java:2997, NP_NULL_ON_SOME_PATH
> * NP: Possible null pointer dereference of invoiceItemSeqId in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.updatePaymentApplicationDefBd(DispatchContext,
>  Map)
> There is a branch of statement that, if executed, guarantees that a null 
> value will be dereferenced, which would generate a NullPointerException when 
> the code is executed. Of course, the problem might be that the branch or 
> statement is infeasible and that the null pointer exception can't ever be 
> executed; deciding that is beyond the ability of FindBugs.
> InvoiceServices.java:3119, RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
> * RCN: Nullcheck of amountApplied at line 3268 of value previously 
> dereferenced in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.updatePaymentApplicationDefBd(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.
> InvoiceServices.java:3268, RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE
> * RCN: Redundant nullcheck of paymentApplicationId which is known to be null 
> in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.updatePaymentApplicationDefBd(DispatchContext,
>  Map)
> This method contains a redundant check of a known null value against the 
> constant null.
> InvoiceServices.java:3268, NP_LOAD_OF_KNOWN_NULL_VALUE
> * NP: Load of known null value in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.updatePaymentApplicationDefBd(DispatchContext,
>  Map)
> The variable referenced at this point is known to be null due to an earlier 
> check against null. Although this is valid, it might be a mistake (perhaps 
> you intended to refer to a different variable, or perhaps the earlier check 
> to see if the variable is null should have been a check to see if it was 
> non-null).
> InvoiceServices.java:3447, RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
> * RCN: Nullcheck of fileBytes at line 3447 of value previously dereferenced 
> in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.importInvoice(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.
> InvoiceServices.java:3451, DLS_DEAD_LOCAL_STORE
> * DLS: Dead store to newErrMsgs in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.importInvoice(DispatchContext,
>  Map)
> This instruction assigns a value to a local variable, but the value is not 
> read or used in any subsequent instruction. Often, this indicates an error, 
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local 
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to 
> eliminate these false positives.
> InvoiceServices.java:3563, UCF_USELESS_CONTROL_FLOW
> * UCF: Useless control flow in 
> org.apache.ofbiz.accounting.invoice.InvoiceServices.importInvoice(DispatchContext,
>  Map)
> This method contains a useless control flow statement, where control flow 
> continues onto the same place regardless of whether or not the branch is 
> taken. For example, this is caused by having an empty statement block for an 
> if statement:
>     if (argv.length == 0) {
>     // TODO: handle this case
>     }
> InvoiceWorker.java:164, DLS_DEAD_LOCAL_STORE
> * DLS: Dead store to invoiceTaxTotal in 
> org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(GenericValue,
>  Boolean)
> This instruction assigns a value to a local variable, but the value is not 
> read or used in any subsequent instruction. Often, this indicates an error, 
> because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local 
> variables. Because FindBugs is a bytecode-based tool, there is no easy way to 
> eliminate these false positives.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to