|
[ https://issues.apache.org/jira/browse/OFBIZ-9454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16080005#comment-16080005 ] Kyra Pritzel-Hentley commented on OFBIZ-9454: --------------------------------------------- The bug DM_DEFAULT_ENCODING does not need a fix since the method UtilXml.writeXmlDocument(requestDocument, os, "UTF-8", true, false, 0) is called before converting the stream to a string. The method writes xml documents which are always encoded in UTF-8 and have an output file which corresponds to the encoding given as an argument (which is UTF-8 as well). Therefore, there should be no varying behavior between platforms. > [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) |
| Free forum by Nabble | Edit this page |
