abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roo...@apache.org
Subject svn commit: r433435 - in /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax: FOMCollection.java FOMDiv.java
Date Tue, 22 Aug 2006 00:06:24 GMT
Author: rooneg
Date: Mon Aug 21 17:06:23 2006
New Revision: 433435

URL: http://svn.apache.org/viewvc?rev=433435&view=rev
Log:
More fun found by FindBugs.

* parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
  (setXhtmlClass): Use a StringBuffer instead of appending to a string
   in a loop.

* parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
  (setAccept): Ditto.

Modified:
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java?rev=433435&r1=433434&r2=433435&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
Mon Aug 21 17:06:23 2006
@@ -129,12 +129,13 @@
 
   public void setAccept(String... mediaRanges) {
     if (mediaRanges != null) {
-      String value = "";
+      StringBuffer value = new StringBuffer();
       for (String type : mediaRanges) {
-        if (value.length() > 0) value+=",";
-        value += type;
+        if (value.length() > 0)
+          value.append(",");
+        value.append(type);
       }
-      _setElementValue(ACCEPT, value);
+      _setElementValue(ACCEPT, value.toString());
     } else {
       _removeChildren(ACCEPT, false);
     }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java?rev=433435&r1=433434&r2=433435&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
Mon Aug 21 17:06:23 2006
@@ -106,12 +106,13 @@
   
   public void setXhtmlClass(String[] classes) {
     if (classes != null) {
-      String val = "";
+      StringBuffer val = new StringBuffer();
       for (String s : classes) {
-        if (s.length() > 0) val += " ";
-        val += s;
+        if (s.length() > 0)
+          val.append(" ");
+        val.append(s);
       }
-      setAttributeValue(CLASS, val);
+      setAttributeValue(CLASS, val.toString());
     } else removeAttribute(CLASS);
   }
 



Mime
View raw message