Author: doogie
Date: Sun May 3 22:51:31 2009 New Revision: 771140 URL: http://svn.apache.org/viewvc?rev=771140&view=rev Log: s/StringBuffer/StringBuilder/; also, fix several .append("" + ""). Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/taxware/TaxwareUTL.java Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java Sun May 3 22:51:31 2009 @@ -97,7 +97,7 @@ String expMonth = (String) context.get("expMonth"); String expYear = (String) context.get("expYear"); - StringBuffer expDate = new StringBuffer(); + StringBuilder expDate = new StringBuilder(); expDate.append(expMonth); expDate.append("/"); expDate.append(expYear); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java Sun May 3 22:51:31 2009 @@ -191,7 +191,7 @@ ps.print(this.toString()); ps.flush(); - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); int size; while ((size = dis.read(readBuffer)) > -1) { buf.append(new String(readBuffer, 0, size)); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java Sun May 3 22:51:31 2009 @@ -318,18 +318,18 @@ String mname = creditCard.getString("middleNameOnCard"); String lname = creditCard.getString("lastNameOnCard"); String sufix = creditCard.getString("suffixOnCard"); - StringBuffer name = new StringBuffer(); + StringBuilder name = new StringBuilder(); if (UtilValidate.isNotEmpty(title)) { - name.append(title + " "); + name.append(title).append(" "); } if (UtilValidate.isNotEmpty(fname)) { - name.append(fname + " "); + name.append(fname).append(" "); } if (UtilValidate.isNotEmpty(mname)) { - name.append(mname + " "); + name.append(mname).append(" "); } if (UtilValidate.isNotEmpty(lname)) { - name.append(lname + " "); + name.append(lname).append(" "); } if (UtilValidate.isNotEmpty(sufix)) { name.append(sufix); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java Sun May 3 22:51:31 2009 @@ -149,7 +149,7 @@ } public String toString() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); Iterator i = document.entrySet().iterator(); while (i.hasNext()) { Map.Entry entry = (Map.Entry) i.next(); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java Sun May 3 22:51:31 2009 @@ -396,18 +396,18 @@ String mname = creditCard.getString("middleNameOnCard"); String lname = creditCard.getString("lastNameOnCard"); String sufix = creditCard.getString("suffixOnCard"); - StringBuffer name = new StringBuffer(); + StringBuilder name = new StringBuilder(); if (UtilValidate.isNotEmpty(title)) { - name.append(title + " "); + name.append(title).append(" "); } if (UtilValidate.isNotEmpty(fname)) { - name.append(fname + " "); + name.append(fname).append(" "); } if (UtilValidate.isNotEmpty(mname)) { - name.append(mname + " "); + name.append(mname).append(" "); } if (UtilValidate.isNotEmpty(lname)) { - name.append(lname + " "); + name.append(lname).append(" "); } if (UtilValidate.isNotEmpty(sufix)) { name.append(sufix); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java Sun May 3 22:51:31 2009 @@ -104,18 +104,18 @@ } // setup the output - StringBuffer buf = new StringBuffer(); - buf.append("======== Begin Test String (" + testString.length() + ") ========\n"); - buf.append(testString + "\n"); + StringBuilder buf = new StringBuilder(); + buf.append("======== Begin Test String (").append(testString.length()).append(") ========\n"); + buf.append(testString).append("\n"); buf.append("======== End Test String ========\n\n"); - buf.append("======== Begin Test Bytes (" + testBytes.length + ") ========\n"); - buf.append(StringUtil.toHexString(testBytes) + "\n"); + buf.append("======== Begin Test Bytes (").append(testBytes.length).append(") ========\n"); + buf.append(StringUtil.toHexString(testBytes)).append("\n"); buf.append("======== End Test Bytes ========\n\n"); - buf.append("======== Begin Test Bytes " + desc + " (" + testEncryption.length + ") ========\n"); - buf.append(StringUtil.toHexString(testEncryption) + "\n"); - buf.append("======== End Test Bytes " + desc + " ========\n\n"); + buf.append("======== Begin Test Bytes ").append(desc).append(" (").append(testEncryption.length).append(") ========\n"); + buf.append(StringUtil.toHexString(testEncryption)).append("\n"); + buf.append("======== End Test Bytes ").append(desc).append(" ========\n\n"); String output = buf.toString(); Debug.log(":: KEK Test Output ::\n\n" + output, module); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java Sun May 3 22:51:31 2009 @@ -134,7 +134,7 @@ PayflowAPI pfp = init(delegator, paymentGatewayConfigId, configString, context); // get the base params - StringBuffer params = makeBaseParams(delegator, paymentGatewayConfigId, configString); + StringBuilder params = makeBaseParams(delegator, paymentGatewayConfigId, configString); // parse the context parameters params.append("&").append(parseContext(data)); @@ -198,7 +198,7 @@ PayflowAPI pfp = init(delegator, paymentGatewayConfigId, configString, context); // get the base params - StringBuffer params = makeBaseParams(delegator, paymentGatewayConfigId, configString); + StringBuilder params = makeBaseParams(delegator, paymentGatewayConfigId, configString); // parse the context parameters params.append("&").append(parseContext(data)); @@ -260,7 +260,7 @@ PayflowAPI pfp = init(delegator, paymentGatewayConfigId, configString, context); // get the base params - StringBuffer params = makeBaseParams(delegator, paymentGatewayConfigId, configString); + StringBuilder params = makeBaseParams(delegator, paymentGatewayConfigId, configString); // parse the context parameters params.append("&").append(parseContext(data)); @@ -319,7 +319,7 @@ PayflowAPI pfp = init(delegator, paymentGatewayConfigId, configString, context); // get the base params - StringBuffer params = makeBaseParams(delegator, paymentGatewayConfigId, configString); + StringBuilder params = makeBaseParams(delegator, paymentGatewayConfigId, configString); // parse the context parameters params.append("&").append(parseContext(data)); @@ -558,7 +558,7 @@ } private static String parseContext(Map<String, ? extends Object> context) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); Set<String> keySet = context.keySet(); Iterator<String> i = keySet.iterator(); @@ -589,8 +589,8 @@ return buf.toString(); } - private static StringBuffer makeBaseParams(GenericDelegator delegator, String paymentGatewayConfigId, String resource) { - StringBuffer buf = new StringBuffer(); + private static StringBuilder makeBaseParams(GenericDelegator delegator, String paymentGatewayConfigId, String resource) { + StringBuilder buf = new StringBuilder(); try { buf.append("PARTNER="); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java Sun May 3 22:51:31 2009 @@ -116,9 +116,9 @@ } // build an address string - StringBuffer address = null; + StringBuilder address = null; if (contactAddress != null) { - address = new StringBuffer(); + address = new StringBuilder(); if (contactAddress.get("address1") != null) { address.append(contactAddress.getString("address1").trim()); } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java Sun May 3 22:51:31 2009 @@ -106,11 +106,11 @@ // keep generating new account codes until a unique one is found Random r = new Random(); boolean foundUniqueNewCode = false; - StringBuffer newAccountCode = null; + StringBuilder newAccountCode = null; long count = 0; while (!foundUniqueNewCode) { - newAccountCode = new StringBuffer(codeLength); + newAccountCode = new StringBuilder(codeLength); for (int i = 0; i < codeLength; i++) { newAccountCode.append(char_pool[r.nextInt(char_pool.length)]); } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java Sun May 3 22:51:31 2009 @@ -250,7 +250,7 @@ } public String toString() { - StringBuffer buff = new StringBuffer("OrderListState:\n\t"); + StringBuilder buff = new StringBuilder("OrderListState:\n\t"); buff.append("viewIndex=").append(viewIndex).append(", viewSize=").append(viewSize).append("\n\t"); buff.append(getOrderStatusState().toString()).append("\n\t"); buff.append(getOrderTypeState().toString()).append("\n\t"); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Sun May 3 22:51:31 2009 @@ -614,7 +614,7 @@ if (orderStatusList == null || orderStatusList.size() == 0) return ""; Iterator orderStatusIter = orderStatusList.iterator(); - StringBuffer orderStatusString = new StringBuffer(50); + StringBuilder orderStatusString = new StringBuilder(50); try { boolean isCurrent = true; @@ -1245,7 +1245,7 @@ Debug.logWarning(e, "Problems getting order contact mechs", module); } - StringBuffer emails = new StringBuffer(); + StringBuilder emails = new StringBuilder(); if (orderContactMechs != null) { Iterator oci = orderContactMechs.iterator(); while (oci.hasNext()) { Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Sun May 3 22:51:31 2009 @@ -1796,7 +1796,7 @@ } // create a return message AND create ReturnItemResponse record(s) - StringBuffer successMessage = new StringBuffer(); + StringBuilder successMessage = new StringBuilder(); if (createdOrderIds.size() > 0) { successMessage.append("The following new orders have been created : "); Iterator i = createdOrderIds.iterator(); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Sun May 3 22:51:31 2009 @@ -2495,7 +2495,7 @@ } templateData.put("assignments", assignments); - StringBuffer emailList = new StringBuffer(); + StringBuilder emailList = new StringBuilder(); if (assignedToEmails != null) { Iterator aei = assignedToEmails.iterator(); while (aei.hasNext()) { Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Sun May 3 22:51:31 2009 @@ -1070,7 +1070,7 @@ */ private static String processResult(Map result, HttpServletRequest request) { //Check for errors - StringBuffer errMsg = new StringBuffer(); + StringBuilder errMsg = new StringBuilder(); if (result.containsKey(ModelService.ERROR_MESSAGE_LIST)) { List errorMsgs = (List)result.get(ModelService.ERROR_MESSAGE_LIST); Iterator iterator = errorMsgs.iterator(); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java Sun May 3 22:51:31 2009 @@ -589,7 +589,7 @@ if (productPromo == null) { return ""; } - StringBuffer promoDescBuf = new StringBuffer(); + StringBuilder promoDescBuf = new StringBuilder(); List productPromoRules = productPromo.getRelatedCache("ProductPromoRule", null, null); Iterator promoRulesIter = productPromoRules.iterator(); while (promoRulesIter != null && promoRulesIter.hasNext()) { Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java Sun May 3 22:51:31 2009 @@ -254,7 +254,7 @@ Map shoppingListSurveyInfo = getItemSurveyInfos(shoppingListItems); // add the items - StringBuffer eventMessage = new StringBuffer(); + StringBuilder eventMessage = new StringBuilder(); Iterator i = shoppingListItems.iterator(); while (i.hasNext()) { GenericValue shoppingListItem = (GenericValue) i.next(); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/taxware/TaxwareUTL.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/taxware/TaxwareUTL.java?rev=771140&r1=771139&r2=771140&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/taxware/TaxwareUTL.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/taxware/TaxwareUTL.java Sun May 3 22:51:31 2009 @@ -107,7 +107,7 @@ try { // add the header - StringBuffer outBuffer = new StringBuffer(); + StringBuilder outBuffer = new StringBuilder(); outBuffer.append(outHead.writeDataFile()); @@ -136,7 +136,7 @@ outItem.writeDataFile("TaxwareTest.in"); - StringBuffer retBuffer = taxCalc(outBuffer); + StringBuilder retBuffer = taxCalc(outBuffer); // make the return data file returnCode = processOutFile(retBuffer); @@ -253,8 +253,8 @@ } } - private StringBuffer taxCalc(StringBuffer outBuffer) throws DataFileException, TaxwareException { - StringBuffer inBuffer = new StringBuffer(); + private StringBuilder taxCalc(StringBuilder outBuffer) throws DataFileException, TaxwareException { + StringBuilder inBuffer = new StringBuilder(); int result = callTaxware(outBuffer.toString(), inBuffer); if (Debug.verboseOn()) Debug.logVerbose("Taxware Return: " + result, module); @@ -266,7 +266,7 @@ return inBuffer; } - private int callTaxware(String inString, StringBuffer outBuffer) throws TaxwareException { + private int callTaxware(String inString, StringBuilder outBuffer) throws TaxwareException { try { return taxcommon.CalculateTax(inString, outBuffer); } catch (Exception e) { @@ -283,7 +283,7 @@ throw new TaxwareException("No items have been defined."); } - private int processOutFile(StringBuffer retBuffer) throws DataFileException, TaxwareException { + private int processOutFile(StringBuilder retBuffer) throws DataFileException, TaxwareException { DataFile retHead = createDataFile("TaxwareInHead"); DataFile retItem = createDataFile("TaxwareInItem"); String headStr = retBuffer.toString().substring(0, 283); |
Free forum by Nabble | Edit this page |