You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by ro...@apache.org on 2006/08/22 02:17:44 UTC

svn commit: r433439 - /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java

Author: rooneg
Date: Mon Aug 21 17:17:44 2006
New Revision: 433439

URL: http://svn.apache.org/viewvc?rev=433439&view=rev
Log:
Another nit found by FindBugs.

* client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
  (combine): Use a StringBuffer instead of appending to a string in a loop.

Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java?rev=433439&r1=433438&r2=433439&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java Mon Aug 21 17:17:44 2006
@@ -80,12 +80,13 @@
   }
 
   private String combine(String ... values) {
-    String v = "";
+    StringBuffer v = new StringBuffer();
     for (String val : values) {
-      if (v.length() > 0) v += ", ";
-      v += val;
+      if (v.length() > 0)
+        v.append(", ");
+      v.append(val);
     }
-    return v;
+    return v.toString();
   }
     
   /**



Re: svn commit: r433439 - /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 8/21/06, James M Snell <ja...@gmail.com> wrote:
> Btw, thanks for going through these. Little stuff like this has been on
> my todo list for a while but I never managed to get to it.

Thanks, I'm just enjoying working in a language that has tools to
track down these sort of problems for you ;-)

The freely/cheaply available static analysis tools in Java are WAY
better than the equivalent stuff in C/C++.

-garrett

Re: svn commit: r433439 - /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java

Posted by James M Snell <ja...@gmail.com>.
Btw, thanks for going through these. Little stuff like this has been on
my todo list for a while but I never managed to get to it.

- James

rooneg@apache.org wrote:
> Author: rooneg
> Date: Mon Aug 21 17:17:44 2006
> New Revision: 433439
> 
> URL: http://svn.apache.org/viewvc?rev=433439&view=rev
> Log:
> Another nit found by FindBugs.
> 
> * client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
>   (combine): Use a StringBuffer instead of appending to a string in a loop.
> 
> Modified:
>     incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
> 
> Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
> URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java?rev=433439&r1=433438&r2=433439&view=diff
> ==============================================================================
> --- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java (original)
> +++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java Mon Aug 21 17:17:44 2006
> @@ -80,12 +80,13 @@
>    }
>  
>    private String combine(String ... values) {
> -    String v = "";
> +    StringBuffer v = new StringBuffer();
>      for (String val : values) {
> -      if (v.length() > 0) v += ", ";
> -      v += val;
> +      if (v.length() > 0)
> +        v.append(", ");
> +      v.append(val);
>      }
> -    return v;
> +    return v.toString();
>    }
>      
>    /**
> 
> 
>