You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Karsten Tymann (JIRA)" <ji...@apache.org> on 2017/07/31 13:25:02 UTC

[jira] [Created] (OFBIZ-9545) [FB] Package org.apache.ofbiz.accounting.thirdparty.sagepay

Karsten Tymann created OFBIZ-9545:
-------------------------------------

             Summary: [FB] Package org.apache.ofbiz.accounting.thirdparty.sagepay
                 Key: OFBIZ-9545
                 URL: https://issues.apache.org/jira/browse/OFBIZ-9545
             Project: OFBiz
          Issue Type: Sub-task
          Components: accounting
    Affects Versions: Trunk
            Reporter: Karsten Tymann
            Priority: Minor


SagePayPaymentServices.java:133, NP_NULL_ON_SOME_PATH
* NP: Possible null pointer dereference of processAmount in org.apache.ofbiz.accounting.thirdparty.sagepay.SagePayPaymentServices.buildCustomerBillingInfo(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.

SagePayPaymentServices.java:159, NP_LOAD_OF_KNOWN_NULL_VALUE
*NP: Load of known null value in org.apache.ofbiz.accounting.thirdparty.sagepay.SagePayPaymentServices.ccAuth(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).

SagePayServices.java:64, WMI_WRONG_MAP_ITERATOR
* WMI: org.apache.ofbiz.accounting.thirdparty.sagepay.SagePayServices.buildSagePayProperties(Map, Delegator) 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.

SagePayUtil.java:124, NP_NULL_ON_SOME_PATH
* NP: Possible null pointer dereference of hostUrl in org.apache.ofbiz.accounting.thirdparty.sagepay.SagePayUtil.getHost(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.

SagePayUtil.java:141, DM_DEFAULT_ENCODING
* Dm: Found reliance on default encoding in org.apache.ofbiz.accounting.thirdparty.sagepay.SagePayUtil.getResponseData(HttpResponse): new java.io.InputStreamReader(InputStream)
Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behaviour to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.

SagePayUtil.java:141, OS_OPEN_STREAM
* OS: org.apache.ofbiz.accounting.thirdparty.sagepay.SagePayUtil.getResponseData(HttpResponse) may fail to close stream
The method creates an IO stream object, does not assign it to any fields, pass it to other methods that might close it, or return it, and does not appear to close the stream on all paths out of the method.  This may result in a file descriptor leak.  It is generally a good idea to use a finally block to ensure that streams are closed.

SagePayUtil.java:164, WMI_WRONG_MAP_ITERATOR
* WMI: org.apache.ofbiz.accounting.thirdparty.sagepay.SagePayUtil.getHttpPost(String, 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.


While doing the changes some potential problems with the current behavior of the SagePayPaymentAuthentication occurred which I will describe in the following comment.



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