commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r1057072 - in /commons/proper/lang/branches/LANG_2_X: ./ src/main/java/org/apache/commons/lang/ src/main/java/org/apache/commons/lang/math/ src/main/java/org/apache/commons/lang/text/ src/main/java/org/apache/commons/lang/time/ src/site/cha...
Date Mon, 10 Jan 2011 01:55:58 GMT
Author: niallp
Date: Mon Jan 10 01:55:57 2011
New Revision: 1057072

URL: http://svn.apache.org/viewvc?rev=1057072&view=rev
Log:
LANG-669 Use StrBuilder instead of StringBuffer to improve performance where sync. is not
an issue

Modified:
    commons/proper/lang/branches/LANG_2_X/RELEASE-NOTES.txt
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/CharRange.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/CharSetUtils.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/ClassUtils.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/NumberRange.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringEscapeUtils.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringUtils.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/DoubleRange.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/Fraction.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/IntRange.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/LongRange.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/NumberRange.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/Range.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/text/ExtendedMessageFormat.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/time/DurationFormatUtils.java
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/time/FastDateFormat.java
    commons/proper/lang/branches/LANG_2_X/src/site/changes/changes.xml

Modified: commons/proper/lang/branches/LANG_2_X/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/RELEASE-NOTES.txt?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/RELEASE-NOTES.txt (original)
+++ commons/proper/lang/branches/LANG_2_X/RELEASE-NOTES.txt Mon Jan 10 01:55:57 2011
@@ -47,6 +47,7 @@ BUG FIXES IN 2.6
 TASKS IN 2.6
 ============
 
+    * [LANG-669] - Use StrBuilder instead of StringBuffer to improve performance where sync.
is not an issue
     * [LANG-600] - Javadoc is incorrect for lastIndexOf() method
     * [LANG-628] - Javadoc for HashCodeBuilder.append(boolean) does not match implementation
     * [LANG-643] - Javadoc StringUtils.left() claims to throw an exception on negative lenth,
but doesn't

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/CharRange.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/CharRange.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/CharRange.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/CharRange.java
Mon Jan 10 01:55:57 2011
@@ -20,6 +20,8 @@ import java.io.Serializable;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
+import org.apache.commons.lang.text.StrBuilder;
+
 /**
  * <p>A contiguous range of characters, optionally negated.</p>
  * 
@@ -267,7 +269,7 @@ public final class CharRange implements 
      */
     public String toString() {
         if (iToString == null) {
-            StringBuffer buf = new StringBuffer(4);
+            StrBuilder buf = new StrBuilder(4);
             if (isNegated()) {
                 buf.append('^');
             }

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/CharSetUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/CharSetUtils.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/CharSetUtils.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/CharSetUtils.java
Mon Jan 10 01:55:57 2011
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.lang;
 
+import org.apache.commons.lang.text.StrBuilder;
+
 /**
  * <p>Operations on <code>CharSet</code>s.</p>
  *
@@ -122,7 +124,7 @@ public class CharSetUtils {
             return str;
         }
         CharSet chars = CharSet.getInstance(set);
-        StringBuffer buffer = new StringBuffer(str.length());
+        StrBuilder buffer = new StrBuilder(str.length());
         char[] chrs = str.toCharArray();
         int sz = chrs.length;
         char lastChar = ' ';
@@ -320,7 +322,7 @@ public class CharSetUtils {
      */
     private static String modify(String str, String[] set, boolean expect) {
         CharSet chars = CharSet.getInstance(set);
-        StringBuffer buffer = new StringBuffer(str.length());
+        StrBuilder buffer = new StrBuilder(str.length());
         char[] chrs = str.toCharArray();
         int sz = chrs.length;
         for(int i=0; i<sz; i++) {
@@ -369,7 +371,7 @@ public class CharSetUtils {
         if (StringUtils.isEmpty(str)) {
             return str;
         }
-        StringBuffer buffer = new StringBuffer(str.length());
+        StrBuilder buffer = new StrBuilder(str.length());
         char[] chrs = str.toCharArray();
         char[] withChrs = replaceChars.toCharArray();
         int sz = chrs.length;

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/ClassUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/ClassUtils.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/ClassUtils.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/ClassUtils.java
Mon Jan 10 01:55:57 2011
@@ -24,6 +24,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.lang.text.StrBuilder;
 
 /**
  * <p>Operates on classes without using reflection.</p>
@@ -188,7 +189,7 @@ public class ClassUtils {
             return StringUtils.EMPTY;
         }
 
-        StringBuffer arrayPrefix = new StringBuffer();
+        StrBuilder arrayPrefix = new StrBuilder();
 
         // Handle array encoding
         if (className.startsWith("[")) {
@@ -888,7 +889,7 @@ public class ClassUtils {
         if (className == null) {
             throw new NullArgumentException("className");
         } else if (className.endsWith("[]")) {
-            StringBuffer classNameBuffer = new StringBuffer();
+            StrBuilder classNameBuffer = new StrBuilder();
             while (className.endsWith("[]")) {
                 className = className.substring(0, className.length() - 2);
                 classNameBuffer.append("[");
@@ -1057,7 +1058,7 @@ public class ClassUtils {
                             className.substring(0, 1));
                     }
                 }
-                StringBuffer canonicalClassNameBuffer = new StringBuffer(className);
+                StrBuilder canonicalClassNameBuffer = new StrBuilder(className);
                 for (int i = 0; i < dim; i++) {
                     canonicalClassNameBuffer.append("[]");
                 }

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/NumberRange.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/NumberRange.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/NumberRange.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/NumberRange.java
Mon Jan 10 01:55:57 2011
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.lang;
 
+import org.apache.commons.lang.text.StrBuilder;
+
 /**
  * <p>Represents a range of {@link Number} objects.</p>
  * 
@@ -194,7 +196,7 @@ public final class NumberRange {
      * @return the string representation of this range
      */
     public String toString() {
-        StringBuffer sb = new StringBuffer();
+        StrBuilder sb = new StrBuilder();
 
         if (min.doubleValue() < 0) {
             sb.append('(')

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringEscapeUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringEscapeUtils.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringEscapeUtils.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringEscapeUtils.java
Mon Jan 10 01:55:57 2011
@@ -22,6 +22,7 @@ import java.io.Writer;
 import java.util.Locale;
 
 import org.apache.commons.lang.exception.NestableRuntimeException;
+import org.apache.commons.lang.text.StrBuilder;
 
 /**
  * <p>Escapes and unescapes <code>String</code>s for
@@ -314,7 +315,7 @@ public class StringEscapeUtils {
             return;
         }
         int sz = str.length();
-        StringBuffer unicode = new StringBuffer(4);
+        StrBuilder unicode = new StrBuilder(4);
         boolean hadSlash = false;
         boolean inUnicode = false;
         for (int i = 0; i < sz; i++) {

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringUtils.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringUtils.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringUtils.java
Mon Jan 10 01:55:57 2011
@@ -22,6 +22,8 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 
+import org.apache.commons.lang.text.StrBuilder;
+
 /**
  * <p>Operations on {@link java.lang.String} that are
  * <code>null</code> safe.</p>
@@ -3208,7 +3210,7 @@ public class StringUtils {
         }
 
         bufSize *= ((array[startIndex] == null ? 16 : array[startIndex].toString().length())
+ 1);
-        StringBuffer buf = new StringBuffer(bufSize);
+        StrBuilder buf = new StrBuilder(bufSize);
 
         for (int i = startIndex; i < endIndex; i++) {
             if (i > startIndex) {
@@ -3297,7 +3299,7 @@ public class StringUtils {
         bufSize *= ((array[startIndex] == null ? 16 : array[startIndex].toString().length())
                         + separator.length());
 
-        StringBuffer buf = new StringBuffer(bufSize);
+        StrBuilder buf = new StrBuilder(bufSize);
 
         for (int i = startIndex; i < endIndex; i++) {
             if (i > startIndex) {
@@ -3339,7 +3341,7 @@ public class StringUtils {
         }
 
         // two or more elements
-        StringBuffer buf = new StringBuffer(256); // Java default is 16, probably too small
+        StrBuilder buf = new StrBuilder(256); // Java default is 16, probably too small
         if (first != null) {
             buf.append(first);
         }
@@ -3383,7 +3385,7 @@ public class StringUtils {
         }
 
         // two or more elements
-        StringBuffer buf = new StringBuffer(256); // Java default is 16, probably too small
+        StrBuilder buf = new StrBuilder(256); // Java default is 16, probably too small
         if (first != null) {
             buf.append(first);
         }
@@ -3810,7 +3812,7 @@ public class StringUtils {
         int increase = replacement.length() - replLength;
         increase = (increase < 0 ? 0 : increase);
         increase *= (max < 0 ? 16 : (max > 64 ? 64 : max));
-        StringBuffer buf = new StringBuffer(text.length() + increase);
+        StrBuilder buf = new StrBuilder(text.length() + increase);
         while (end != INDEX_NOT_FOUND) {
             buf.append(text.substring(start, end)).append(replacement);
             start = end + replLength;
@@ -4048,7 +4050,7 @@ public class StringUtils {
         // have upper-bound at 20% increase, then let Java take over
         increase = Math.min(increase, text.length() / 5);
 
-        StringBuffer buf = new StringBuffer(text.length() + increase);
+        StrBuilder buf = new StrBuilder(text.length() + increase);
 
         while (textIndex != -1) {
 
@@ -4172,7 +4174,7 @@ public class StringUtils {
         boolean modified = false;
         int replaceCharsLength = replaceChars.length();
         int strLength = str.length();
-        StringBuffer buf = new StringBuffer(strLength);
+        StrBuilder buf = new StrBuilder(strLength);
         for (int i = 0; i < strLength; i++) {
             char ch = str.charAt(i);
             int index = searchChars.indexOf(ch);
@@ -4219,7 +4221,7 @@ public class StringUtils {
      *             Method will be removed in Commons Lang 3.0.
      */
     public static String overlayString(String text, String overlay, int start, int end) {
-        return new StringBuffer(start + overlay.length() + text.length() - end + 1)
+        return new StrBuilder(start + overlay.length() + text.length() - end + 1)
             .append(text.substring(0, start))
             .append(overlay)
             .append(text.substring(end))
@@ -4280,7 +4282,7 @@ public class StringUtils {
             start = end;
             end = temp;
         }
-        return new StringBuffer(len + start - end + overlay.length() + 1)
+        return new StrBuilder(len + start - end + overlay.length() + 1)
             .append(str.substring(0, start))
             .append(overlay)
             .append(str.substring(end))
@@ -4621,7 +4623,7 @@ public class StringUtils {
                 }
                 return new String(output2);
             default :
-                StringBuffer buf = new StringBuffer(outputLength);
+                StrBuilder buf = new StrBuilder(outputLength);
                 for (int i = 0; i < repeat; i++) {
                     buf.append(str);
                 }
@@ -5164,7 +5166,7 @@ public class StringUtils {
         if (str == null || (strLen = str.length()) == 0) {
             return str;
         }
-        return new StringBuffer(strLen)
+        return new StrBuilder(strLen)
             .append(Character.toTitleCase(str.charAt(0)))
             .append(str.substring(1))
             .toString();
@@ -5208,7 +5210,7 @@ public class StringUtils {
         if (str == null || (strLen = str.length()) == 0) {
             return str;
         }
-        return new StringBuffer(strLen)
+        return new StrBuilder(strLen)
             .append(Character.toLowerCase(str.charAt(0)))
             .append(str.substring(1))
             .toString();
@@ -5259,7 +5261,7 @@ public class StringUtils {
         if (str == null || (strLen = str.length()) == 0) {
             return str;
         }
-        StringBuffer buffer = new StringBuffer(strLen);
+        StrBuilder buffer = new StrBuilder(strLen);
 
         char ch = 0;
         for (int i = 0; i < strLen; i++) {
@@ -5751,7 +5753,7 @@ public class StringUtils {
     // Reversing
     //-----------------------------------------------------------------------
     /**
-     * <p>Reverses a String as per {@link StringBuffer#reverse()}.</p>
+     * <p>Reverses a String as per {@link StrBuilder#reverse()}.</p>
      *
      * <p>A <code>null</code> String returns <code>null</code>.</p>
      *
@@ -5768,7 +5770,7 @@ public class StringUtils {
         if (str == null) {
             return null;
         }
-        return new StringBuffer(str).reverse().toString();
+        return new StrBuilder(str).reverse().toString();
     }
 
     /**
@@ -5980,7 +5982,7 @@ public class StringUtils {
         int startOffset = targetSting/2+targetSting%2;
         int endOffset = str.length()-targetSting/2;
         
-        StringBuffer builder = new StringBuffer(length);
+        StrBuilder builder = new StrBuilder(length);
         builder.append(str.substring(0,startOffset));
         builder.append(middle);
         builder.append(str.substring(endOffset));
@@ -6544,7 +6546,7 @@ public class StringUtils {
         if(str == null || str.length() <= 2) {
             return str;
         }
-        StringBuffer b = new StringBuffer(str.length());
+        StrBuilder b = new StrBuilder(str.length());
         for (int i = 0; i < str.length(); i++) {
             char c = str.charAt(i);
             if (Character.isWhitespace(c)) {

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/DoubleRange.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/DoubleRange.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/DoubleRange.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/DoubleRange.java
Mon Jan 10 01:55:57 2011
@@ -18,6 +18,8 @@ package org.apache.commons.lang.math;
 
 import java.io.Serializable;
 
+import org.apache.commons.lang.text.StrBuilder;
+
 /**
  * <p><code>DoubleRange</code> represents an inclusive range of <code>double</code>s.</p>
  *
@@ -402,7 +404,7 @@ public final class DoubleRange extends R
      */
     public String toString() {
         if (toString == null) {
-            StringBuffer buf = new StringBuffer(32);
+            StrBuilder buf = new StrBuilder(32);
             buf.append("Range[");
             buf.append(min);
             buf.append(',');

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/Fraction.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/Fraction.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/Fraction.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/Fraction.java
Mon Jan 10 01:55:57 2011
@@ -18,6 +18,8 @@ package org.apache.commons.lang.math;
 
 import java.math.BigInteger;
 
+import org.apache.commons.lang.text.StrBuilder;
+
 /**
  * <p><code>Fraction</code> is a <code>Number</code> implementation
that
  * stores fractions accurately.</p>
@@ -896,7 +898,7 @@ public final class Fraction extends Numb
      */
     public String toString() {
         if (toString == null) {
-            toString = new StringBuffer(32)
+            toString = new StrBuilder(32)
                 .append(getNumerator())
                 .append('/')
                 .append(getDenominator()).toString();
@@ -930,13 +932,13 @@ public final class Fraction extends Numb
                 if (properNumerator == 0) {
                     toProperString = Integer.toString(getProperWhole());
                 } else {
-                    toProperString = new StringBuffer(32)
+                    toProperString = new StrBuilder(32)
                         .append(getProperWhole()).append(' ')
                         .append(properNumerator).append('/')
                         .append(getDenominator()).toString();
                 }
             } else {
-                toProperString = new StringBuffer(32)
+                toProperString = new StrBuilder(32)
                     .append(getNumerator()).append('/')
                     .append(getDenominator()).toString();
             }

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/IntRange.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/IntRange.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/IntRange.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/IntRange.java
Mon Jan 10 01:55:57 2011
@@ -18,6 +18,8 @@ package org.apache.commons.lang.math;
 
 import java.io.Serializable;
 
+import org.apache.commons.lang.text.StrBuilder;
+
 /**
  * <p><code>IntRange</code> represents an inclusive range of <code>int</code>s.</p>
  *
@@ -370,7 +372,7 @@ public final class IntRange extends Rang
      */
     public String toString() {
         if (toString == null) {
-            StringBuffer buf = new StringBuffer(32);
+            StrBuilder buf = new StrBuilder(32);
             buf.append("Range[");
             buf.append(min);
             buf.append(',');

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/LongRange.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/LongRange.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/LongRange.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/LongRange.java
Mon Jan 10 01:55:57 2011
@@ -18,6 +18,8 @@ package org.apache.commons.lang.math;
 
 import java.io.Serializable;
 
+import org.apache.commons.lang.text.StrBuilder;
+
 /**
  * <p><code>LongRange</code> represents an inclusive range of <code>long</code>s.</p>
  *
@@ -383,7 +385,7 @@ public final class LongRange extends Ran
      */
     public String toString() {
         if (toString == null) {
-            StringBuffer buf = new StringBuffer(32);
+            StrBuilder buf = new StrBuilder(32);
             buf.append("Range[");
             buf.append(min);
             buf.append(',');

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/NumberRange.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/NumberRange.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/NumberRange.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/NumberRange.java
Mon Jan 10 01:55:57 2011
@@ -18,6 +18,8 @@ package org.apache.commons.lang.math;
 
 import java.io.Serializable;
 
+import org.apache.commons.lang.text.StrBuilder;
+
 /**
  * <p><code>NumberRange</code> represents an inclusive range of 
  * {@link java.lang.Number} objects of the same type.</p>
@@ -228,7 +230,7 @@ public final class NumberRange extends R
      */
     public String toString() {
         if (toString == null) {
-            StringBuffer buf = new StringBuffer(32);
+            StrBuilder buf = new StrBuilder(32);
             buf.append("Range[");
             buf.append(min);
             buf.append(',');

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/Range.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/Range.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/Range.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/Range.java
Mon Jan 10 01:55:57 2011
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.lang.math;
 
+import org.apache.commons.lang.text.StrBuilder;
+
 /**
  * <p><code>Range</code> represents a range of numbers of the same type.</p>
  * 
@@ -419,7 +421,7 @@ public abstract class Range {
      * @return the <code>String</code> representation of this range
      */
     public String toString() {
-        StringBuffer buf = new StringBuffer(32);
+        StrBuilder buf = new StrBuilder(32);
         buf.append("Range[");
         buf.append(getMinimumNumber());
         buf.append(',');

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/text/ExtendedMessageFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/text/ExtendedMessageFormat.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/text/ExtendedMessageFormat.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/text/ExtendedMessageFormat.java
Mon Jan 10 01:55:57 2011
@@ -147,7 +147,7 @@ public class ExtendedMessageFormat exten
         }
         ArrayList foundFormats = new ArrayList();
         ArrayList foundDescriptions = new ArrayList();
-        StringBuffer stripCustom = new StringBuffer(pattern.length());
+        StrBuilder stripCustom = new StrBuilder(pattern.length());
 
         ParsePosition pos = new ParsePosition(0);
         char[] c = pattern.toCharArray();
@@ -270,7 +270,7 @@ public class ExtendedMessageFormat exten
     private int readArgumentIndex(String pattern, ParsePosition pos) {
         int start = pos.getIndex();
         seekNonWs(pattern, pos);
-        StringBuffer result = new StringBuffer();
+        StrBuilder result = new StrBuilder();
         boolean error = false;
         for (; !error && pos.getIndex() < pattern.length(); next(pos)) {
             char c = pattern.charAt(pos.getIndex());
@@ -345,7 +345,7 @@ public class ExtendedMessageFormat exten
         if (!containsElements(customPatterns)) {
             return pattern;
         }
-        StringBuffer sb = new StringBuffer(pattern.length() * 2);
+        StrBuilder sb = new StrBuilder(pattern.length() * 2);
         ParsePosition pos = new ParsePosition(0);
         int fe = -1;
         int depth = 0;
@@ -414,8 +414,8 @@ public class ExtendedMessageFormat exten
      * @param escapingOn whether to process escaped quotes
      * @return <code>appendTo</code>
      */
-    private StringBuffer appendQuotedString(String pattern, ParsePosition pos,
-            StringBuffer appendTo, boolean escapingOn) {
+    private StrBuilder appendQuotedString(String pattern, ParsePosition pos,
+            StrBuilder appendTo, boolean escapingOn) {
         int start = pos.getIndex();
         char[] c = pattern.toCharArray();
         if (escapingOn && c[start] == QUOTE) {

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/time/DurationFormatUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/time/DurationFormatUtils.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/time/DurationFormatUtils.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/time/DurationFormatUtils.java
Mon Jan 10 01:55:57 2011
@@ -23,6 +23,7 @@ import java.util.GregorianCalendar;
 import java.util.TimeZone;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.text.StrBuilder;
 
 /**
  * <p>Duration formatting utilities and constants. The following table describes the
tokens 
@@ -420,7 +421,7 @@ public class DurationFormatUtils {
      */
     static String format(Token[] tokens, int years, int months, int days, int hours, int
minutes, int seconds,
             int milliseconds, boolean padWithZeros) {
-        StringBuffer buffer = new StringBuffer();
+        StrBuilder buffer = new StrBuilder();
         boolean lastOutputSeconds = false;
         int sz = tokens.length;
         for (int i = 0; i < sz; i++) {

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/time/FastDateFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/time/FastDateFormat.java?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/time/FastDateFormat.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/time/FastDateFormat.java
Mon Jan 10 01:55:57 2011
@@ -35,6 +35,7 @@ import java.util.Map;
 import java.util.TimeZone;
 
 import org.apache.commons.lang.Validate;
+import org.apache.commons.lang.text.StrBuilder;
 
 /**
  * <p>FastDateFormat is a fast and thread-safe version of
@@ -704,7 +705,7 @@ public class FastDateFormat extends Form
      * @return parsed token
      */
     protected String parseToken(String pattern, int[] indexRef) {
-        StringBuffer buf = new StringBuffer();
+        StrBuilder buf = new StrBuilder();
 
         int i = indexRef[0];
         int length = pattern.length();

Modified: commons/proper/lang/branches/LANG_2_X/src/site/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/site/changes/changes.xml?rev=1057072&r1=1057071&r2=1057072&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/site/changes/changes.xml (original)
+++ commons/proper/lang/branches/LANG_2_X/src/site/changes/changes.xml Mon Jan 10 01:55:57
2011
@@ -40,6 +40,7 @@
     <action type="fix" issue="LANG-607">StringUtils methods do not handle Unicode 2.0+
supplementary characters correctly</action>
     <action type="fix" issue="LANG-624">SystemUtils: getJavaVersionAsFloat throws StringIndexOutOfBoundsException
on Android runtime/Dalvik VM</action>
     <action type="fix" issue="BEANUTILS-381">MemberUtils: getMatchingAccessibleMethod
does not correctly handle inheritance and method overloading</action>
+    <action type="update" issue="LANG-669">Use StrBuilder instead of StringBuffer to
improve performance where sync. is not an issue</action>
     <action type="update" issue="LANG-600">Javadoc is incorrect for lastIndexOf() method</action>
     <action type="update" issue="LANG-628">Javadoc for HashCodeBuilder.append(boolean)
does not match implementation</action>
     <action type="update" issue="LANG-643">Javadoc StringUtils.left() claims to throw
an exception on negative lenth, but doesn't</action>



Mime
View raw message