commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1333721 - in /commons/proper/codec/trunk/src: changes/ main/java/org/apache/commons/codec/language/ main/java/org/apache/commons/codec/net/
Date Fri, 04 May 2012 01:06:10 GMT
Author: sebb
Date: Fri May  4 01:06:10 2012
New Revision: 1333721

URL: http://svn.apache.org/viewvc?rev=1333721&view=rev
Log:
CODEC-143 StringBuffer could be replaced by StringBuilder for local variables

Modified:
    commons/proper/codec/trunk/src/changes/changes.xml
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Nysiis.java
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java

Modified: commons/proper/codec/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/changes/changes.xml?rev=1333721&r1=1333720&r2=1333721&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/changes/changes.xml (original)
+++ commons/proper/codec/trunk/src/changes/changes.xml Fri May  4 01:06:10 2012
@@ -51,6 +51,9 @@ The <action> type attribute can be add,u
     </release>
     -->
     <release version="1.7" date="TBD" description="Feature and fix release.">
+      <action issue="CODEC-143" dev="sebb" type="update">
+        StringBuffer could be replaced by StringBuilder for local variables.
+      </action>
       <action dev="ggregory" type="add" issue="CODEC-139" due-to="dsebastien">
         DigestUtils: add updateDigest methods and make methods public.
       </action>

Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java?rev=1333721&r1=1333720&r2=1333721&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
(original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
Fri May  4 01:06:10 2012
@@ -1035,8 +1035,8 @@ public class DoubleMetaphone implements 
      */
     public class DoubleMetaphoneResult {
 
-        private final StringBuffer primary = new StringBuffer(getMaxCodeLen());
-        private final StringBuffer alternate = new StringBuffer(getMaxCodeLen());
+        private final StringBuilder primary = new StringBuilder(getMaxCodeLen());
+        private final StringBuilder alternate = new StringBuilder(getMaxCodeLen());
         private final int maxLength;
 
         public DoubleMetaphoneResult(int maxLength) {

Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java?rev=1333721&r1=1333720&r2=1333721&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java
(original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java
Fri May  4 01:06:10 2012
@@ -97,8 +97,8 @@ public class Metaphone implements String
       
         char[] inwd = txt.toUpperCase(java.util.Locale.ENGLISH).toCharArray() ;
       
-        StringBuffer local = new StringBuffer(40); // manipulate
-        StringBuffer code = new StringBuffer(10) ; //   output
+        StringBuilder local = new StringBuilder(40); // manipulate
+        StringBuilder code = new StringBuilder(10) ; //   output
         // handle initial 2 characters exceptions
         switch(inwd[0]) {
         case 'K' : 
@@ -320,11 +320,11 @@ public class Metaphone implements String
         return code.toString();
     }
 
-    private boolean isVowel(StringBuffer string, int index) {
+    private boolean isVowel(StringBuilder string, int index) {
         return VOWELS.indexOf(string.charAt(index)) >= 0;
     }
 
-    private boolean isPreviousChar(StringBuffer string, int index, char c) {
+    private boolean isPreviousChar(StringBuilder string, int index, char c) {
         boolean matches = false;
         if( index > 0 &&
             index < string.length() ) {
@@ -333,7 +333,7 @@ public class Metaphone implements String
         return matches;
     }
 
-    private boolean isNextChar(StringBuffer string, int index, char c) {
+    private boolean isNextChar(StringBuilder string, int index, char c) {
         boolean matches = false;
         if( index >= 0 &&
             index < string.length() - 1 ) {
@@ -342,7 +342,7 @@ public class Metaphone implements String
         return matches;
     }
 
-    private boolean regionMatch(StringBuffer string, int index, String test) {
+    private boolean regionMatch(StringBuilder string, int index, String test) {
         boolean matches = false;
         if( index >= 0 &&
             index + test.length() - 1 < string.length() ) {

Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Nysiis.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Nysiis.java?rev=1333721&r1=1333720&r2=1333721&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Nysiis.java
(original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Nysiis.java
Fri May  4 01:06:10 2012
@@ -272,7 +272,7 @@ public class Nysiis implements StringEnc
         str = PAT_DT_ETC.matcher(str).replaceFirst("D");
 
         // First character of key = first character of name.
-        StringBuffer key = new StringBuffer(str.length());
+        StringBuilder key = new StringBuilder(str.length());
         key.append(str.charAt(0));
 
         // Transcode remaining characters, incrementing by one character each time

Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java?rev=1333721&r1=1333720&r2=1333721&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java
(original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java
Fri May  4 01:06:10 2012
@@ -181,7 +181,7 @@ public class RefinedSoundex implements S
             return str;
         }
 
-        StringBuffer sBuf = new StringBuffer();
+        StringBuilder sBuf = new StringBuilder();
         sBuf.append(str.charAt(0));
 
         char last, current;

Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java?rev=1333721&r1=1333720&r2=1333721&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java
(original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java
Fri May  4 01:06:10 2012
@@ -84,7 +84,7 @@ abstract class RFC1522Codec {
         if (text == null) {
             return null;
         }
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         buffer.append(PREFIX); 
         buffer.append(charset);
         buffer.append(SEP);



Mime
View raw message