Author: doogie
Date: Thu Apr 30 01:22:44 2009 New Revision: 770030 URL: http://svn.apache.org/viewvc?rev=770030&view=rev Log: Fix some StringBuffer usage that has crept in. Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/location/FlexibleLocation.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/AbtractAuthorization.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/location/FlexibleLocation.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/location/FlexibleLocation.java?rev=770030&r1=770029&r2=770030&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/location/FlexibleLocation.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/location/FlexibleLocation.java Thu Apr 30 01:22:44 2009 @@ -158,7 +158,7 @@ return ""; } - StringBuffer strippedSoFar = new StringBuffer(location); + StringBuilder strippedSoFar = new StringBuilder(location); // first take care of the colon and everything before it int colonIndex = strippedSoFar.indexOf(":"); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java?rev=770030&r1=770029&r2=770030&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java Thu Apr 30 01:22:44 2009 @@ -613,7 +613,7 @@ * @return the converted string */ public static String collapseCharacter(String str, char c) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); char last = str.charAt(0); for (int i = 0; i < str.length(); i++) { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java?rev=770030&r1=770029&r2=770030&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java Thu Apr 30 01:22:44 2009 @@ -501,17 +501,17 @@ if (diff < 0) { return str.substring(0, setLen); } else { - String newString = new String(); + StringBuilder newString = new StringBuilder(); if (padEnd) { - newString = newString + str; + newString.append(str); } for (int i = 0; i < diff; i++) { - newString = newString + padChar; + newString.append(padChar); } if (!padEnd) { - newString = newString + str; + newString.append(str); } - return newString; + return newString.toString(); } } public static String makeSqlSafe(String unsafeString) { @@ -522,7 +522,7 @@ if (original == null) return null; if (original.length() <= 4) return original; - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); for(int i=0; i < original.length()-4 ; i++) { buffer.append('*'); } Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java?rev=770030&r1=770029&r2=770030&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java Thu Apr 30 01:22:44 2009 @@ -44,7 +44,7 @@ public static String getCodeCaptcha(HttpServletRequest request,HttpServletResponse response) { if (CAPTCHA_FILE_PATH != null) deleteFile(); - StringBuffer finalString = new StringBuffer(); + StringBuilder finalString = new StringBuilder(); String elegibleChars = "ABCDEFGHJKLMPQRSTUVWXYabcdefhjkmnpqrstuvwxy23456789"; int charsToPrint = 6; char[] chars = elegibleChars.toCharArray(); @@ -178,4 +178,4 @@ public static int paramInt(HttpServletRequest request, String paramName, int defaultInt) { return request.getParameter(paramName) != null ? Integer.parseInt(request.getParameter(paramName)) : defaultInt; } -} \ No newline at end of file +} Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java?rev=770030&r1=770029&r2=770030&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java Thu Apr 30 01:22:44 2009 @@ -344,7 +344,7 @@ } public String getPkShortValueString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (ModelField curPk: this.getModelEntity().getPkFieldsUnmodifiable()) { if (sb.length() > 0) { sb.append("::"); @@ -999,7 +999,7 @@ */ public void writeXmlText(PrintWriter writer, String prefix) { int indent = 4; - StringBuffer indentStrBuf = new StringBuffer(); + StringBuilder indentStrBuf = new StringBuilder(); for (int i = 0; i < indent; i++) indentStrBuf.append(' '); String indentString = indentStrBuf.toString(); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java?rev=770030&r1=770029&r2=770030&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java Thu Apr 30 01:22:44 2009 @@ -236,7 +236,7 @@ return ""; } - StringBuffer returnString = new StringBuffer(""); + StringBuilder returnString = new StringBuilder(); Iterator iter = modelFields.iterator(); while (iter.hasNext()) { Object item = iter.next(); Modified: ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/AbtractAuthorization.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/AbtractAuthorization.java?rev=770030&r1=770029&r2=770030&view=diff ============================================================================== --- ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/AbtractAuthorization.java (original) +++ ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/AbtractAuthorization.java Thu Apr 30 01:22:44 2009 @@ -85,7 +85,7 @@ // split the permission string; so we can walk up the levels String[] permSplit = expandedPermission.split(":"); - StringBuffer joined = new StringBuffer(); + StringBuilder joined = new StringBuilder(); int index = 1; if (permSplit != null && permSplit.length > 1) { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=770030&r1=770029&r2=770030&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Thu Apr 30 01:22:44 2009 @@ -2322,7 +2322,7 @@ } public void renderHyperlinkTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String titleText) throws IOException { if (UtilValidate.isNotEmpty(modelFormField.getHeaderLink())) { - StringBuffer targetBuffer = new StringBuffer(); + StringBuilder targetBuffer = new StringBuilder(); FlexibleStringExpander target = FlexibleStringExpander.getInstance(modelFormField.getHeaderLink()); String fullTarget = target.expandString(context); targetBuffer.append(fullTarget); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=770030&r1=770029&r2=770030&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Thu Apr 30 01:22:44 2009 @@ -1008,7 +1008,7 @@ } // create a title from the name of this field; expecting a Java method/field style name, ie productName or productCategoryId - StringBuffer autoTitlewriter = new StringBuffer(); + StringBuilder autoTitlewriter = new StringBuilder(); // always use upper case first letter... autoTitlewriter.append(Character.toUpperCase(this.name.charAt(0))); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=770030&r1=770029&r2=770030&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Thu Apr 30 01:22:44 2009 @@ -162,7 +162,7 @@ ModelFormField modelFormField = displayField.getModelFormField(); ModelForm modelForm = modelFormField.getModelForm(); - StringBuffer str = new StringBuffer(); + StringBuilder str = new StringBuilder(); String idName = modelFormField.getIdName(); if (UtilValidate.isNotEmpty(idName) && ("list".equals(modelForm.getType()) || "multi".equals(modelForm.getType()))) { @@ -2858,7 +2858,7 @@ */ public void renderHyperlinkTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String titleText) throws IOException { if (UtilValidate.isNotEmpty(modelFormField.getHeaderLink())) { - StringBuffer targetBuffer = new StringBuffer(); + StringBuilder targetBuffer = new StringBuilder(); FlexibleStringExpander target = FlexibleStringExpander.getInstance(modelFormField.getHeaderLink()); String fullTarget = target.expandString(context); targetBuffer.append(fullTarget); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java?rev=770030&r1=770029&r2=770030&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java Thu Apr 30 01:22:44 2009 @@ -73,7 +73,7 @@ public Writer getWriter(final Writer out, Map args) { Map<String, Object> checkedArgs = UtilGenerics.checkMap(args); - final StringBuffer buf = new StringBuffer(); + final StringBuilder buf = new StringBuilder(); final Environment env = Environment.getCurrentEnvironment(); final Map<String, Object> templateCtx = UtilGenerics.checkMap(FreeMarkerWorker.getWrappedObject("context", env)); final GenericDelegator delegator = (GenericDelegator) FreeMarkerWorker.getWrappedObject("delegator", env); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java?rev=770030&r1=770029&r2=770030&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java Thu Apr 30 01:22:44 2009 @@ -424,7 +424,7 @@ if (messages.size() > 0) { messages.add(0, "Error with comparison in if-compare between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and value [" + value + "] with operator [" + operator + "] and type [" + type + "]: "); - StringBuffer fullString = new StringBuffer(); + StringBuilder fullString = new StringBuilder(); for (Object message: messages) { fullString.append((String) message); } @@ -474,7 +474,7 @@ if (messages.size() > 0) { messages.add(0, "Error with comparison in if-compare-field between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and to-field [" + toFieldVal.toString() + "] with value [" + toFieldVal + "] with operator [" + operator + "] and type [" + type + "]: "); - StringBuffer fullString = new StringBuffer(); + StringBuilder fullString = new StringBuilder(); for (Object message: messages) { fullString.append((String) message); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java?rev=770030&r1=770029&r2=770030&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java Thu Apr 30 01:22:44 2009 @@ -325,7 +325,7 @@ if (messages.size() > 0) { messages.add(0, "Error with comparison in if-compare between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and value [" + value + "] with operator [" + operator + "] and type [" + type + "]: "); - StringBuffer fullString = new StringBuffer(); + StringBuilder fullString = new StringBuilder(); for (Object message: messages) { fullString.append((String) message); } @@ -375,7 +375,7 @@ if (messages.size() > 0) { messages.add(0, "Error with comparison in if-compare-field between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and to-field [" + toFieldVal.toString() + "] with value [" + toFieldVal + "] with operator [" + operator + "] and type [" + type + "]: "); - StringBuffer fullString = new StringBuffer(); + StringBuilder fullString = new StringBuilder(); for (Object message: messages) { fullString.append((String) message); } |
Free forum by Nabble | Edit this page |