Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-9450 Fixing defects reported by code analysis tools
  3. OFBIZ-9454

[FB] Package org.apache.ofbiz.accounting.thirdparty.clearcommerce

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Trunk
    • 17.12.01
    • accounting
    • None
    • Patch

    Description

      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.

      Attachments

        Activity

          People

            mbrohl Michael Brohl
            Kyra Pritzel-Hentley Kyra Pritzel-Hentley
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: