You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Kyra Pritzel-Hentley (JIRA)" <ji...@apache.org> on 2017/07/07 12:06:01 UTC

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

Kyra Pritzel-Hentley created OFBIZ-9454:
-------------------------------------------

             Summary: [FB] Package org.apache.ofbiz.accounting.thirdparty.clearcommerce
                 Key: OFBIZ-9454
                 URL: https://issues.apache.org/jira/browse/OFBIZ-9454
             Project: OFBiz
          Issue Type: Sub-task
          Components: accounting
    Affects Versions: Trunk
            Reporter: Kyra Pritzel-Hentley
            Priority: Minor


CCPaymentServices.java:78: 109: 144: 178: 235: 270, DM_BOOLEAN_CTOR
* Dm: org.apache.ofbiz.accounting.thirdparty.clearcommerce.CCPaymentServices.ccAuth(DispatchContext, Map) invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
* Dm: org.apache.ofbiz.accounting.thirdparty.clearcommerce.CCPaymentServices.ccCredit(DispatchContext, Map) invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
* Dm: org.apache.ofbiz.accounting.thirdparty.clearcommerce.CCPaymentServices.ccCapture(DispatchContext, Map) invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
* Dm: org.apache.ofbiz.accounting.thirdparty.clearcommerce.CCPaymentServices.ccRelease(DispatchContext, Map) invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
* Dm: org.apache.ofbiz.accounting.thirdparty.clearcommerce.CCPaymentServices.ccRefund(DispatchContext, Map) invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
* Dm: org.apache.ofbiz.accounting.thirdparty.clearcommerce.CCPaymentServices.ccReAuth(DispatchContext, Map) invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead

Creating new instances of java.lang.Boolean wastes memory, since Boolean objects are immutable and there are only two useful values of this type.  Use the Boolean.valueOf() method (or Java 1.5 autoboxing) to create Boolean objects instead.


CCPaymentServices.java:772, SBSC_USE_STRINGBUFFER_CONCATENATION
* SBSC: org.apache.ofbiz.accounting.thirdparty.clearcommerce.CCPaymentServices.appendPaymentMechNode(Element, GenericValue, String, String) concatenates strings using + in a loop
The method seems to be building a String using concatenation in a loop. In each iteration, the String is converted to a StringBuffer/StringBuilder, appended to, and converted back to a String. This can lead to a cost quadratic in the number of iterations, as the growing string is recopied in each iteration.
Better performance can be obtained by using a StringBuffer (or StringBuilder in Java 1.5) explicitly.

CCPaymentServices.java:902, DM_DEFAULT_ENCODING
* Dm: Found reliance on default encoding in org.apache.ofbiz.accounting.thirdparty.clearcommerce.CCPaymentServices.sendRequest(Document, String, Delegator): java.io.ByteArrayOutputStream.toString()
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 behavior to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.

CCServicesTest.java:101: 131: 162: 209, DM_BOOLEAN_CTOR, Priorität: Normal
* Dm: org.apache.ofbiz.accounting.thirdparty.clearcommerce.CCServicesTest.testAuth() invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
* Dm: org.apache.ofbiz.accounting.thirdparty.clearcommerce.CCServicesTest.testCredit() invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
* Dm: org.apache.ofbiz.accounting.thirdparty.clearcommerce.CCServicesTest.testPurchaseSubscription() invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
* Dm: org.apache.ofbiz.accounting.thirdparty.clearcommerce.CCServicesTest.testCCReport() invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
Creating new instances of java.lang.Boolean wastes memory, since Boolean objects are immutable and there are only two useful values of this type.  Use the Boolean.valueOf() method (or Java 1.5 autoboxing) to create Boolean objects instead.




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