commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r1214688 - in /commons/proper/cli/trunk/src/main/java/org/apache/commons/cli: AmbiguousOptionException.java CommandLine.java HelpFormatter.java MissingOptionException.java Option.java Options.java
Date Thu, 15 Dec 2011 10:26:52 GMT
Author: ebourg
Date: Thu Dec 15 10:26:52 2011
New Revision: 1214688

URL: http://svn.apache.org/viewvc?rev=1214688&view=rev
Log:
Replaced StringBuilder with StringBuffer wherever possible without breaking binary compatibility

Modified:
    commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
    commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/CommandLine.java
    commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/HelpFormatter.java
    commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/MissingOptionException.java
    commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java
    commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Options.java

Modified: commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java?rev=1214688&r1=1214687&r2=1214688&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
(original)
+++ commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
Thu Dec 15 10:26:52 2011
@@ -66,23 +66,23 @@ public class AmbiguousOptionException ex
      */
     private static String createMessage(String option, Collection<String> matchingOptions)
     {
-        StringBuffer buff = new StringBuffer("Ambiguous option: '");
-        buff.append(option);
-        buff.append("'  (could be: ");
+        StringBuilder buf = new StringBuilder("Ambiguous option: '");
+        buf.append(option);
+        buf.append("'  (could be: ");
 
         Iterator<String> it = matchingOptions.iterator();
         while (it.hasNext())
         {
-            buff.append("'");
-            buff.append(it.next());
-            buff.append("'");
+            buf.append("'");
+            buf.append(it.next());
+            buf.append("'");
             if (it.hasNext())
             {
-                buff.append(", ");
+                buf.append(", ");
             }
         }
-        buff.append(")");
+        buf.append(")");
 
-        return buff.toString();
+        return buf.toString();
     }
 }

Modified: commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/CommandLine.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/CommandLine.java?rev=1214688&r1=1214687&r2=1214688&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/CommandLine.java (original)
+++ commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/CommandLine.java Thu Dec
15 10:26:52 2011
@@ -321,7 +321,7 @@ public class CommandLine implements Seri
 
     /*
     public String toString() {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
             
         buf.append("[ CommandLine: [ options: ");
         buf.append(options.toString());

Modified: commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/HelpFormatter.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/HelpFormatter.java?rev=1214688&r1=1214687&r2=1214688&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/HelpFormatter.java (original)
+++ commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/HelpFormatter.java Thu Dec
15 10:26:52 2011
@@ -804,7 +804,7 @@ public class HelpFormatter
         for (Iterator i = optList.iterator(); i.hasNext();)
         {
             Option option = (Option) i.next();
-            StringBuffer optBuf = new StringBuffer(prefixList.get(x++).toString());
+            StringBuilder optBuf = new StringBuilder(prefixList.get(x++).toString());
 
             if (optBuf.length() < max)
             {
@@ -894,7 +894,7 @@ public class HelpFormatter
      * @param nextLineTabStop The position on the next line for the first tab.
      * @param text The text to be rendered.
      */
-    private StringBuffer renderWrappedTextBlock(StringBuffer sb, int width, int nextLineTabStop,
String text)
+    private Appendable renderWrappedTextBlock(StringBuffer sb, int width, int nextLineTabStop,
String text)
     {
         try
         {

Modified: commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/MissingOptionException.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/MissingOptionException.java?rev=1214688&r1=1214687&r2=1214688&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/MissingOptionException.java
(original)
+++ commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/MissingOptionException.java
Thu Dec 15 10:26:52 2011
@@ -78,20 +78,20 @@ public class MissingOptionException exte
      */
     private static String createMessage(List missingOptions)
     {
-        StringBuffer buff = new StringBuffer("Missing required option");
-        buff.append(missingOptions.size() == 1 ? "" : "s");
-        buff.append(": ");
+        StringBuilder buf = new StringBuilder("Missing required option");
+        buf.append(missingOptions.size() == 1 ? "" : "s");
+        buf.append(": ");
 
         Iterator it = missingOptions.iterator();
         while (it.hasNext())
         {
-            buff.append(it.next());
+            buf.append(it.next());
             if (it.hasNext())
             {
-                buff.append(", ");
+                buf.append(", ");
             }
         }
 
-        return buff.toString();
+        return buf.toString();
     }
 }

Modified: commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java?rev=1214688&r1=1214687&r2=1214688&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java (original)
+++ commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java Thu Dec 15 10:26:52
2011
@@ -547,7 +547,7 @@ public class Option implements Cloneable
      */
     public String toString()
     {
-        StringBuffer buf = new StringBuffer().append("[ option: ");
+        StringBuilder buf = new StringBuilder().append("[ option: ");
 
         buf.append(opt);
 

Modified: commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Options.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Options.java?rev=1214688&r1=1214687&r2=1214688&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Options.java (original)
+++ commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Options.java Thu Dec 15
10:26:52 2011
@@ -294,7 +294,7 @@ public class Options implements Serializ
      */
     public String toString()
     {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
 
         buf.append("[ Options: [ short ");
         buf.append(shortOpts.toString());



Mime
View raw message