click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bck...@apache.org
Subject svn commit: r986273 - in /click/trunk/click: extras/src/org/apache/click/extras/control/ extras/src/org/apache/click/extras/tree/ framework/src/org/apache/click/ framework/src/org/apache/click/control/ framework/src/org/apache/click/element/ framework/...
Date Tue, 17 Aug 2010 11:48:43 GMT
Author: bckfnn
Date: Tue Aug 17 11:48:42 2010
New Revision: 986273

URL: http://svn.apache.org/viewvc?rev=986273&view=rev
Log:
use Map.entrySet() for iteration. suggested by findbugs.

Modified:
    click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java
    click/trunk/click/extras/src/org/apache/click/extras/tree/Tree.java
    click/trunk/click/framework/src/org/apache/click/Page.java
    click/trunk/click/framework/src/org/apache/click/control/FieldSet.java
    click/trunk/click/framework/src/org/apache/click/control/Form.java
    click/trunk/click/framework/src/org/apache/click/element/CssImport.java
    click/trunk/click/framework/src/org/apache/click/element/JsImport.java
    click/trunk/click/framework/src/org/apache/click/util/HtmlStringBuffer.java

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java?rev=986273&r1=986272&r2=986273&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java Tue Aug 17
11:48:42 2010
@@ -850,10 +850,10 @@ public class PickList extends Field {
 
         if (hasAttributes()) {
             Map<String, String> localAttributes = getAttributes();
-            for (String attrName : localAttributes.keySet()) {
+            for (Map.Entry<String, String> entry : localAttributes.entrySet()) {
+                String attrName = entry.getKey(); 
                 if (!attrName.equals("id") && !attrName.equals("class")) {
-                    Object attrValue = localAttributes.get(attrName);
-                    attributesBuffer.appendAttributeEscaped(attrName, attrValue);
+                    attributesBuffer.appendAttributeEscaped(attrName, entry.getValue());
                 }
             }
         }

Modified: click/trunk/click/extras/src/org/apache/click/extras/tree/Tree.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/tree/Tree.java?rev=986273&r1=986272&r2=986273&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/tree/Tree.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/tree/Tree.java Tue Aug 17 11:48:42
2010
@@ -1611,11 +1611,11 @@ public class Tree extends AbstractContro
                 new HtmlStringBuffer(uri.length() + (parameters.size() * 20));
 
         buffer.append(uri);
-        if (parameters != null && !parameters.isEmpty()) {
+        if (!parameters.isEmpty()) {
             buffer.append("?");
-            Iterator i = parameters.entrySet().iterator();
+            Iterator<? extends Map.Entry<String, ?>> i = parameters.entrySet().iterator();
             while (i.hasNext()) {
-                Map.Entry entry = (Map.Entry) i.next();
+                Map.Entry<String, ?> entry = i.next();
                 String name = entry.getKey().toString();
                 String value = entry.getValue().toString();
 

Modified: click/trunk/click/framework/src/org/apache/click/Page.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/Page.java?rev=986273&r1=986272&r2=986273&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/Page.java (original)
+++ click/trunk/click/framework/src/org/apache/click/Page.java Tue Aug 17 11:48:42 2010
@@ -1195,9 +1195,11 @@ public class Page implements Serializabl
         if (params != null && !params.isEmpty()) {
             HtmlStringBuffer buffer = new HtmlStringBuffer();
 
-            for (Iterator<String> i = params.keySet().iterator(); i.hasNext();) {
-                String paramName = i.next();
-                Object paramValue = params.get(paramName);
+            Iterator<? extends Map.Entry<String, ?>> i = params.entrySet().iterator();
+            while (i.hasNext()) {
+                Map.Entry<String, ?> entry = i.next(); 
+                String paramName = entry.getKey();
+                Object paramValue = entry.getValue();
 
                 // Check for multivalued parameter
                 if (paramValue instanceof String[]) {

Modified: click/trunk/click/framework/src/org/apache/click/control/FieldSet.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/FieldSet.java?rev=986273&r1=986272&r2=986273&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/FieldSet.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/FieldSet.java Tue Aug 17 11:48:42
2010
@@ -1055,10 +1055,10 @@ public class FieldSet extends Field impl
 
                     if (label.hasAttributes()) {
                         Map<String, String> labelAttributes = label.getAttributes();
-                        for (String labelAttrName : labelAttributes.keySet()) {
+                        for (Map.Entry<String, String> entry : labelAttributes.entrySet())
{
+                            String labelAttrName = entry.getKey();
                             if (!labelAttrName.equals("id") && !labelAttrName.equals("style"))
{
-                                Object labelAttrValue = labelAttributes.get(labelAttrName);
-                                buffer.appendAttributeEscaped(labelAttrName, labelAttrValue);
+                                buffer.appendAttributeEscaped(labelAttrName, entry.getValue());
                             }
                         }
                     }

Modified: click/trunk/click/framework/src/org/apache/click/control/Form.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/Form.java?rev=986273&r1=986272&r2=986273&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/Form.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/Form.java Tue Aug 17 11:48:42
2010
@@ -2510,10 +2510,10 @@ public class Form extends AbstractContai
 
                     if (label.hasAttributes()) {
                         Map<String, String> labelAttributes = label.getAttributes();
-                        for (String labelAttrName : labelAttributes.keySet()) {
+                        for (Map.Entry<String, String> entry : labelAttributes.entrySet())
{
+                            String labelAttrName = entry.getKey();
                             if (!labelAttrName.equals("id") && !labelAttrName.equals("style"))
{
-                                Object labelAttrValue = labelAttributes.get(labelAttrName);
-                                buffer.appendAttributeEscaped(labelAttrName, labelAttrValue);
+                                buffer.appendAttributeEscaped(labelAttrName, entry.getValue());
                             }
                         }
                     }

Modified: click/trunk/click/framework/src/org/apache/click/element/CssImport.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/element/CssImport.java?rev=986273&r1=986272&r2=986273&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/element/CssImport.java (original)
+++ click/trunk/click/framework/src/org/apache/click/element/CssImport.java Tue Aug 17 11:48:42
2010
@@ -218,10 +218,10 @@ public class CssImport extends ResourceE
         renderResourcePath(buffer, "href", href);
 
         Map<String, String> localAttributes = getAttributes();
-        for (String name : localAttributes.keySet()) {
+        for (Map.Entry<String, String> entry : localAttributes.entrySet()) {
+            String name = entry.getKey();
             if (!name.equals("id") && !name.equals("href")) {
-                Object value = localAttributes.get(name);
-                buffer.appendAttributeEscaped(name, value);
+                buffer.appendAttributeEscaped(name, entry.getValue());
             }
         }
 

Modified: click/trunk/click/framework/src/org/apache/click/element/JsImport.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/element/JsImport.java?rev=986273&r1=986272&r2=986273&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/element/JsImport.java (original)
+++ click/trunk/click/framework/src/org/apache/click/element/JsImport.java Tue Aug 17 11:48:42
2010
@@ -217,10 +217,10 @@ public class JsImport extends ResourceEl
         renderResourcePath(buffer, "src", src);
 
         Map<String, String> localAttributes = getAttributes();
-        for (String name : localAttributes.keySet()) {
+        for (Map.Entry<String, String> entry : localAttributes.entrySet()) {
+            String name = entry.getKey();
             if (!name.equals("id") && !name.equals("src")) {
-                Object value = localAttributes.get(name);
-                buffer.appendAttributeEscaped(name, value);
+                buffer.appendAttributeEscaped(name, entry.getValue());
             }
         }
 

Modified: click/trunk/click/framework/src/org/apache/click/util/HtmlStringBuffer.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/HtmlStringBuffer.java?rev=986273&r1=986272&r2=986273&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/HtmlStringBuffer.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/HtmlStringBuffer.java Tue Aug 17
11:48:42 2010
@@ -350,10 +350,10 @@ public class HtmlStringBuffer {
         if (attributes == null) {
             throw new IllegalArgumentException("Null attributes parameter");
         }
-        for (String name : attributes.keySet()) {
+        for (Map.Entry<String, String> entry : attributes.entrySet()) {
+            String name = entry.getKey();
             if (!name.equals("id")) {
-                Object value = attributes.get(name);
-                appendAttributeEscaped(name, value);
+                appendAttributeEscaped(name, entry.getValue());
             }
         }
 
@@ -376,10 +376,10 @@ public class HtmlStringBuffer {
         if (!attributes.isEmpty()) {
             append(" style=\"");
 
-            for (String name : attributes.keySet()) {
-                append(name);
+            for (Map.Entry<String, String> entry : attributes.entrySet()) {
+                append(entry.getKey());
                 append(":");
-                append(attributes.get(name));
+                append(entry.getValue());
                 append(";");
             }
 



Mime
View raw message