cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r123825 - in cocoon/branches/BRANCH_2_1_X/src: blocks/naming/java/org/apache/cocoon/components/naming blocks/portal/java/org/apache/cocoon/components/modules/input blocks/portal/java/org/apache/cocoon/environment/portlet blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory blocks/portal/java/org/apache/cocoon/portal/pluto/test java/org/apache/cocoon/acting java/org/apache/cocoon/components/modules/output java/org/apache/cocoon/components/notification java/org/apache/cocoon/components/treeprocessor java/org/apache/cocoon/util java/org/apache/cocoon/xml/dom
Date Fri, 31 Dec 2004 21:18:02 GMT
Author: antonio
Date: Fri Dec 31 13:18:01 2004
New Revision: 123825

URL: http://svn.apache.org/viewcvs?view=rev&rev=123825
Log:
Use entrySet instead of keySet
Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/naming/java/org/apache/cocoon/components/naming/LDAPEntryManager.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/components/modules/input/PortletURLModule.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/ActionResponse.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/test/TestPortlet.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/SessionValidatorAction.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/RequestAttributeOutputModule.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/SessionAttributeOutputModule.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/notification/Notifier.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/MRUBucketMap.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/naming/java/org/apache/cocoon/components/naming/LDAPEntryManager.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/naming/java/org/apache/cocoon/components/naming/LDAPEntryManager.java?view=diff&rev=123825&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/naming/java/org/apache/cocoon/components/naming/LDAPEntryManager.java&r1=123824&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/naming/java/org/apache/cocoon/components/naming/LDAPEntryManager.java&r2=123825
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/naming/java/org/apache/cocoon/components/naming/LDAPEntryManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/naming/java/org/apache/cocoon/components/naming/LDAPEntryManager.java
Fri Dec 31 13:18:01 2004
@@ -274,16 +274,14 @@
 	*/
 	private Attributes map2Attributes (Map map) {
 		Attributes attrs = new BasicAttributes (false);
-		Iterator keys = map.keySet ().iterator ();
-		while (keys.hasNext ()) {
-			String key = (String)keys.next ();
-			Iterator vals = ((List)map.get (key)).iterator ();
-			Attribute attr = new BasicAttribute (key);
-			while (vals.hasNext ()) {
-				attr.add(vals.next());
-			}
-			attrs.put (attr);
-		}
+        for (Iterator i = map.entrySet().iterator(); i.hasNext(); ) {
+            Map.Entry me = (Map.Entry)i.next();
+            String key = (String)me.getKey();
+            Attribute attr = new BasicAttribute(key);
+            for (Iterator vals = ((List)me.getValue()).iterator(); vals.hasNext(); ) {
+                attr.add(vals.next());
+            }
+        }
 		return attrs;
 	}
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/components/modules/input/PortletURLModule.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/components/modules/input/PortletURLModule.java?view=diff&rev=123825&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/components/modules/input/PortletURLModule.java&r1=123824&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/components/modules/input/PortletURLModule.java&r2=123825
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/components/modules/input/PortletURLModule.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/components/modules/input/PortletURLModule.java
Fri Dec 31 13:18:01 2004
@@ -49,7 +49,7 @@
  * <code>portlet:render:</code>, <code>portlet:resource:</code>)
are omitted.
  *
  * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
- * @version CVS $Id: PortletURLModule.java,v 1.2 2004/03/05 13:02:07 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class PortletURLModule extends AbstractInputModule implements ThreadSafe {
 
@@ -113,16 +113,16 @@
             if (name.length() > 0) {
                 parameters.put(PortletEnvironment.PARAMETER_PATH_INFO, name);
             }
-            for (Iterator i = parameters.keySet().iterator(); i.hasNext();) {
-                String param = (String) i.next();
-                Object values = parameters.get(param);
+            for (Iterator i = parameters.entrySet().iterator(); i.hasNext();) {
+                Map.Entry me = (Map.Entry)i.next();
+                String param = (String)me.getKey();
+                Object values = me.getValue();
                 if (values instanceof String) {
                     url.setParameter(param, (String) values);
                 } else {
                     url.setParameter(param, (String[]) values);
-                }
+                } 
             }
-
             return url.toString();
         } else {
             if (name.startsWith(PREFIX_RENDER)) {

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/ActionResponse.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/ActionResponse.java?view=diff&rev=123825&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/ActionResponse.java&r1=123824&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/ActionResponse.java&r2=123825
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/ActionResponse.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/ActionResponse.java
Fri Dec 31 13:18:01 2004
@@ -35,7 +35,7 @@
  * the JSR-168 (Portlet) environment.
  *
  * @author <a href="mailto:vadim.gritsenko@dc.gov">Vadim Gritsenko</a>
- * @version CVS $Id: ActionResponse.java,v 1.3 2004/05/01 00:05:44 joerg Exp $
+ * @version CVS $Id$
  */
 public final class ActionResponse extends PortletResponse {
 
@@ -134,9 +134,10 @@
         if (absLoc.startsWith(servletPath)) {
             String pathInfo = absLoc.substring(servletPath.length());
 
-            for (Iterator i = parameters.keySet().iterator(); i.hasNext();) {
-                String name = (String) i.next();
-                String value = (String) parameters.get(name);
+            for (Iterator i = parameters.entrySet().iterator(); i.hasNext();) {
+                Map.Entry me = (Map.Entry)i.next();
+                String name = (String)me.getKey();
+                String value = (String)me.getValue();
                 getActionResponse().setRenderParameter(name, value);
             }
             getActionResponse().setRenderParameter(PortletEnvironment.PARAMETER_PATH_INFO,
pathInfo);

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java?view=diff&rev=123825&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java&r1=123824&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java&r2=123825
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java
Fri Dec 31 13:18:01 2004
@@ -131,16 +131,16 @@
         factories.put(ObjectIDFactory.class.getName(), ObjectIDFactoryImpl.class.getName());
 
         factories.put(ControllerFactory.class.getName(), ControllerFactoryImpl.class.getName());
-    
-        for (Iterator iter = factories.keySet().iterator(); iter.hasNext (); ) {
-            String factoryInterfaceName = (String) iter.next ();
-
+  
+        for (Iterator iter = factories.entrySet().iterator(); iter.hasNext (); ) {
+            Map.Entry me = (Map.Entry)iter.next();
+            String factoryInterfaceName = (String)me.getKey();
             // try to get hold of the factory
             Class factoryInterface;
 
             factoryInterface = Class.forName (factoryInterfaceName);
 
-            String factoryImplName = (String)factories.get(factoryInterfaceName);
+            String factoryImplName = (String)me.getValue();
             Class factoryImpl = Class.forName (factoryImplName);
             Factory factory = (Factory) factoryImpl.newInstance ();
 
@@ -155,9 +155,8 @@
 
             // build up list in reverse order for later destruction
             factoryList.add (0, factory);
-
+            
         }
-
     }
 
     /* (non-Javadoc)

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/test/TestPortlet.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/test/TestPortlet.java?view=diff&rev=123825&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/test/TestPortlet.java&r1=123824&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/test/TestPortlet.java&r2=123825
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/test/TestPortlet.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/test/TestPortlet.java
Fri Dec 31 13:18:01 2004
@@ -90,10 +90,10 @@
         writer.write("<p>Portlet Preferences:</p>");
         PortletPreferences prefs = req.getPreferences();
         Map map = prefs.getMap();
-        Iterator iter = map.keySet().iterator();
-        while (iter.hasNext()) {
-            String key = (String)iter.next();
-            String[] values = (String [])map.get(key);
+        for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) {
+            Map.Entry me = (Map.Entry)iter.next();
+            String key = (String)me.getKey();
+            String[] values = (String [])me.getValue();
             if (values.length == 1) {
                 writer.write("    Key: " + key + " Value: " + values[0] + "<br />");
             } else if (values.length > 1) {

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/SessionValidatorAction.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/SessionValidatorAction.java?view=diff&rev=123825&p1=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/SessionValidatorAction.java&r1=123824&p2=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/SessionValidatorAction.java&r2=123825
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/SessionValidatorAction.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/SessionValidatorAction.java
Fri Dec 31 13:18:01 2004
@@ -35,7 +35,7 @@
  *
  * @author <a href="mailto:Martin.Man@seznam.cz">Martin Man</a>
  * @author <a href="mailto:haul@apache.org">Christian Haul</a>
- * @version CVS $Id: SessionValidatorAction.java,v 1.3 2004/03/05 13:02:43 bdelacretaz Exp
$
+ * @version CVS $Id$
  */
 public class SessionValidatorAction extends AbstractValidatorAction implements ThreadSafe
{
 
@@ -62,9 +62,9 @@
     protected Map setResult(Map objectModel, Map actionMap, Map resultMap, boolean allOK)
{
         if (allOK){
             Session session = ObjectModelHelper.getRequest(objectModel).getSession();
-            for (Iterator i = actionMap.keySet().iterator(); i.hasNext(); ){
-                String name = (String) i.next();
-                session.setAttribute(name, actionMap.get(name));
+            for (Iterator i = actionMap.entrySet().iterator(); i.hasNext(); ) {
+                Map.Entry me = (Map.Entry)i.next();
+                session.setAttribute((String)me.getKey(), me.getValue());
             }
         }
         return super.setResult(objectModel, actionMap, resultMap, allOK);

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/RequestAttributeOutputModule.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/RequestAttributeOutputModule.java?view=diff&rev=123825&p1=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/RequestAttributeOutputModule.java&r1=123824&p2=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/RequestAttributeOutputModule.java&r2=123825
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/RequestAttributeOutputModule.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/RequestAttributeOutputModule.java
Fri Dec 31 13:18:01 2004
@@ -36,7 +36,7 @@
  * copied to the final destination.
  *
  * @author <a href="mailto:haul@apache.org">Christian Haul</a>
- * @version CVS $Id: RequestAttributeOutputModule.java,v 1.3 2004/03/05 13:02:49 bdelacretaz
Exp $
+ * @version CVS $Id$
  */
 public class RequestAttributeOutputModule extends AbstractOutputModule implements OutputModule
{
     
@@ -90,29 +90,30 @@
      * */
     public void rollback( Configuration modeConf, Map objectModel, Exception e ) {
         if (this.settings.get("isolation-level","0").equals("1")) {
-            if (getLogger().isDebugEnabled())
+            if (getLogger().isDebugEnabled()) {
                 getLogger().debug("rolling back");
+            }
             this.rollback(objectModel, TRANS_PREFIX);
         } else {
-
-            if (getLogger().isDebugEnabled())
+            if (getLogger().isDebugEnabled()) {
                 getLogger().debug("start rolling back");
-            
+            }
             Request request = ObjectModelHelper.getRequest(objectModel);
-            Object tmp = this.prepareCommit(objectModel,ROLLBACK_LIST);
-            if (tmp != null) {
-                Map rollbackList = (Map) tmp;
-                Iterator iter = rollbackList.keySet().iterator();
-                while(iter.hasNext()) {
-                    String key = (String) iter.next();
-                    Object val = rollbackList.get(key);
+            Map rollbackList = this.prepareCommit(objectModel,ROLLBACK_LIST);
+            if (rollbackList != null) {
+                for (Iterator i = rollbackList.entrySet().iterator(); i.hasNext(); ){
+                    Map.Entry me = (Map.Entry)i.next();
+                    String key = (String)me.getKey();
+                    Object val = me.getValue();
                     if (val != null) {
-                        if (getLogger().isDebugEnabled())
-                            getLogger().debug("rolling back ['"+key+"'] to ['"+val+"']");
+                        if (getLogger().isDebugEnabled()) {
+                            getLogger().debug("rolling back ['" + key + "'] to ['" + val
+ "']");
+                        }
                         request.setAttribute(key, val);
                     } else {
-                        if (getLogger().isDebugEnabled())
-                            getLogger().debug("rolling back ['"+key+"']");
+                        if (getLogger().isDebugEnabled()) {
+                            getLogger().debug("rolling back ['" + key + "']");
+                        }
                         request.removeAttribute(key);
                     }
                 }
@@ -137,47 +138,44 @@
      * */
     public void commit( Configuration modeConf, Map objectModel ) {
         if (this.settings.get("isolation-level","0").equals("1")) {
-            
+
             Logger logger = getLogger();
-            if (logger.isDebugEnabled())
+            if (logger.isDebugEnabled()) {
                 logger.debug("prepare commit");
+            }
 
             Map aMap = this.prepareCommit(objectModel, TRANS_PREFIX);
-            if (aMap == null) {
-                return;
-            }
-        
-            Iterator iter = aMap.keySet().iterator();
-            if (!iter.hasNext()){
+            if (aMap == null || aMap.isEmpty()) {
                 return;
             }
-            
-            String prefix = (String) this.settings.get("key-prefix", PREFIX );
-            if (prefix != "") {
-                prefix = prefix+":";
+            String prefix = (String)this.settings.get("key-prefix", PREFIX );
+            if (prefix.length() > 0) {
+                prefix = prefix + ":";
             } else {
                 prefix = null;
             }
             Request request = ObjectModelHelper.getRequest(objectModel);
-            while (iter.hasNext()) {
-                String key = (String) iter.next();
-                Object value = aMap.get(key);
-                if (prefix != null) { key = prefix + key; }
-                if (logger.isDebugEnabled())
-                    logger.debug("committing ['"+key+"'] to ['"+value+"']");
+            for (Iterator i = aMap.entrySet().iterator(); i.hasNext(); ) {
+                Map.Entry me = (Map.Entry)i.next();
+                String key = (String)me.getKey();
+                Object value = me.getValue();
+                if (prefix != null) {
+                    key = prefix + key;
+                }
+                if (logger.isDebugEnabled()) {
+                    logger.debug("committing ['" + key + "'] to ['" + value + "']");
+                }
                 request.setAttribute(key, value);
             }
-
-            if (logger.isDebugEnabled())
+            if (logger.isDebugEnabled()) {
                 logger.debug("done commit");
-
+            }
         } else {
-            if (getLogger().isDebugEnabled())
+            if (getLogger().isDebugEnabled()) {
                 getLogger().debug("commit");
+            }
             this.prepareCommit(objectModel, ROLLBACK_LIST);
         }
-        
-        
     }
 
     protected String getName( String name ) {

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/SessionAttributeOutputModule.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/SessionAttributeOutputModule.java?view=diff&rev=123825&p1=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/SessionAttributeOutputModule.java&r1=123824&p2=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/SessionAttributeOutputModule.java&r2=123825
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/SessionAttributeOutputModule.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/output/SessionAttributeOutputModule.java
Fri Dec 31 13:18:01 2004
@@ -36,7 +36,7 @@
  * copied to the final destination.
  *
  * @author <a href="mailto:haul@apache.org">Christian Haul</a>
- * @version CVS $Id: SessionAttributeOutputModule.java,v 1.3 2004/03/05 13:02:49 bdelacretaz
Exp $
+ * @version CVS $Id$
  */
 public class SessionAttributeOutputModule extends AbstractOutputModule implements OutputModule
{
     
@@ -91,38 +91,38 @@
      * */
     public void rollback( Configuration modeConf, Map objectModel, Exception e ) {
         if (this.settings.get("isolation-level","0").equals("1")) {
-            if (getLogger().isDebugEnabled())
+            if (getLogger().isDebugEnabled()) {
                 getLogger().debug("rolling back");
+            }
             this.rollback(objectModel, TRANS_PREFIX);
         } else {
-
-            if (getLogger().isDebugEnabled())
+            if (getLogger().isDebugEnabled()) {
                 getLogger().debug("start rolling back");
-            
+            }
             Session session = ObjectModelHelper.getRequest(objectModel).getSession();
-            Object tmp = this.prepareCommit(objectModel,ROLLBACK_LIST);
-            if (tmp != null) {
-                Map rollbackList = (Map) tmp;
-                Iterator iter = rollbackList.keySet().iterator();
-                while(iter.hasNext()) {
-                    String key = (String) iter.next();
-                    Object val = rollbackList.get(key);
+            Map rollbackList = this.prepareCommit(objectModel,ROLLBACK_LIST);
+            if (rollbackList != null) {
+                for (Iterator i = rollbackList.entrySet().iterator(); i.hasNext(); ) {
+                    Map.Entry me = (Map.Entry)i.next();
+                    String key = (String)me.getKey();
+                    Object val = me.getValue();
                     if (val != null) {
-                        if (getLogger().isDebugEnabled())
-                            getLogger().debug("rolling back ['"+key+"'] to ['"+val+"']");
+                        if (getLogger().isDebugEnabled()) {
+                            getLogger().debug("rolling back ['" + key + "'] to ['" + val
+ "']");
+                        }
                         session.setAttribute(key, val);
                     } else {
-                        if (getLogger().isDebugEnabled())
-                            getLogger().debug("rolling back ['"+key+"']");
+                        if (getLogger().isDebugEnabled()) {
+                            getLogger().debug("rolling back ['" + key + "']");
+                        }
                         session.removeAttribute(key);
                     }
                 }
             }
         }
-
-        if (getLogger().isDebugEnabled())
+        if (getLogger().isDebugEnabled()) {
             getLogger().debug("done rolling back");
-
+        }
         String prefix = (String) this.settings.get("key-prefix", PREFIX );
         if (prefix!="") {
             ObjectModelHelper.getRequest(objectModel).getSession().setAttribute(prefix+":",e.getMessage());
@@ -140,44 +140,40 @@
         if (this.settings.get("isolation-level","0").equals("1")) {
 
             Logger logger = getLogger();
-            if (logger.isDebugEnabled())
+            if (logger.isDebugEnabled()) {
                 logger.debug("prepare commit");
-
-            Map aMap = this.prepareCommit(objectModel, TRANS_PREFIX);
-            if (aMap == null) {
-                return;
             }
-            
-            Iterator iter = aMap.keySet().iterator();
-            if (!iter.hasNext()){
+            Map aMap = this.prepareCommit(objectModel, TRANS_PREFIX);
+            if (aMap == null || aMap.isEmpty()) {
                 return;
             }
-            
-            String prefix = (String) this.settings.get("key-prefix", PREFIX );
-            if (prefix != "") {
-                prefix = prefix+":";
+            String prefix = (String)this.settings.get("key-prefix", PREFIX );
+            if (prefix.length() > 0) {
+                prefix = prefix + ":";
             } else {
                 prefix = null;
             }
             Session session = ObjectModelHelper.getRequest(objectModel).getSession();
-            while (iter.hasNext()) {
-                String key = (String) iter.next();
-                Object value = aMap.get(key);
-                if (prefix != null) { key = prefix + key; }
-                if (logger.isDebugEnabled())
-                    logger.debug("committing ['"+key+"'] to ['"+value+"']");
+            for (Iterator i = aMap.entrySet().iterator(); i.hasNext(); ) {
+                Map.Entry me = (Map.Entry)i.next();
+                String key = (String)me.getKey();
+                Object value = me.getValue();
+                if (prefix != null) {
+                    key = prefix + key;
+                }
+                if (logger.isDebugEnabled()) {
+                    logger.debug("committing ['" + key + "'] to ['" + value + "']");
+                }
                 session.setAttribute(key, value);
             }
-
-            if (logger.isDebugEnabled())
+            if (logger.isDebugEnabled()) {
                 logger.debug("done commit");
-
+            }
         } else {
             if (getLogger().isDebugEnabled())
                 getLogger().debug("commit");
             this.prepareCommit(objectModel, ROLLBACK_LIST);
         }
-        
     }
     
     protected String getName( String name ) {

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/notification/Notifier.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/notification/Notifier.java?view=diff&rev=123825&p1=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/notification/Notifier.java&r1=123824&p2=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/notification/Notifier.java&r2=123825
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/notification/Notifier.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/notification/Notifier.java
Fri Dec 31 13:18:01 2004
@@ -88,16 +88,14 @@
           .append(StringEscapeUtils.escapeXml(n.getSource())).append("</p>");
 
         Map extras = n.getExtraDescriptions();
-        Iterator i = extras.keySet().iterator();
-        while (i.hasNext()) {
-            final String key = (String) i.next();
-
+        for (Iterator i = extras.entrySet().iterator(); i.hasNext(); ) {
+            Map.Entry me = (Map.Entry)i.next();
+            final String key = (String)me.getKey();
             sb.append("<p><span>")
-              .append(key).append("</span><pre>")
-              .append(StringEscapeUtils.escapeXml(String.valueOf(extras.get(key))))
-              .append("</pre></p>");
+            .append(key).append("</span><pre>")
+            .append(StringEscapeUtils.escapeXml(String.valueOf(me.getValue())))
+            .append("</pre></p>");
         }
-
         sb.append("<p class='footer'><a href='http://cocoon.apache.org/'>").append(Constants.COMPLETE_NAME).append("</p>");
         sb.append("</body></html>");
 
@@ -140,12 +138,11 @@
         ch.endElement(URI, "description", PREFIX + ":description");
 
         Map extraDescriptions = n.getExtraDescriptions();
-        Iterator keyIter = extraDescriptions.keySet().iterator();
-        while (keyIter.hasNext()) {
-            String key = (String) keyIter.next();
-            String value = String.valueOf(extraDescriptions.get(key));
+        for (Iterator i = extraDescriptions.entrySet().iterator(); i.hasNext(); ) {
+            Map.Entry me = (Map.Entry)i.next();
+            String key = (String)me.getKey();
+            String value = String.valueOf(me.getValue());
             atts = new AttributesImpl();
-
             atts.addAttribute(URI, "description", PREFIX + ":description", "CDATA", key);
             ch.startElement(URI, "extra", PREFIX + ":extra", atts);
             ch.characters(value.toCharArray(), 0, value.length());

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java?view=diff&rev=123825&p1=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java&r1=123824&p2=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java&r2=123825
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
Fri Dec 31 13:18:01 2004
@@ -228,13 +228,12 @@
                 }
                 sb.append("\n");
 
-                Iterator keys = map.keySet().iterator();
-                while (keys.hasNext()) {
-                    Object key = keys.next();
+                for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) {
+                    Map.Entry me = (Map.Entry)iter.next();
+                    Object key = me.getKey();
                     sb.append("PARAM: '").append(path).append(key).append("' ");
-                    sb.append("VALUE: '").append(map.get(key)).append("'\n");
+                    sb.append("VALUE: '").append(me.getValue()).append("'\n");
                 }
-
                 path = "../" + path;
             }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/MRUBucketMap.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/MRUBucketMap.java?view=diff&rev=123825&p1=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/MRUBucketMap.java&r1=123824&p2=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/MRUBucketMap.java&r2=123825
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/MRUBucketMap.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/MRUBucketMap.java	Fri Dec
31 13:18:01 2004
@@ -310,12 +310,9 @@
      */
     public void putAll( Map other )
     {
-        Iterator i = other.keySet().iterator();
-
-        while( i.hasNext() )
-        {
-            Object key = i.next();
-            put( key, other.get( key ) );
+        for (Iterator i = other.entrySet().iterator(); i.hasNext(); ) {
+            Map.Entry me = (Map.Entry)i.next();
+            put(me.getKey(), me.getValue());
         }
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java?view=diff&rev=123825&p1=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java&r1=123824&p2=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java&r2=123825
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java	Fri Dec 31
13:18:01 2004
@@ -59,7 +59,7 @@
  *  getting and setting values of nodes.
  *
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
- * @version CVS $Id: DOMUtil.java,v 1.10 2004/03/28 23:57:41 antonio Exp $
+ * @version CVS $Id$
 */
 public final class DOMUtil {
 
@@ -505,22 +505,21 @@
      */
     public static void valueOf(Node parent, Map v) throws ProcessingException {
         if (v != null) {
-            Iterator iterator = v.keySet().iterator();
             Node mapNode = parent.getOwnerDocument().createElementNS(null, "java.util.map");
             parent.appendChild(mapNode);
-            while (iterator.hasNext()) {
-                Object key = iterator.next();
-
+            for (Iterator iter = v.entrySet().iterator(); iter.hasNext(); ) {
+                Map.Entry me = (Map.Entry)iter.next();
+                
                 Node entryNode = mapNode.getOwnerDocument().createElementNS(null, "entry");
                 mapNode.appendChild(entryNode);
 
                 Node keyNode = entryNode.getOwnerDocument().createElementNS(null, "key");
                 entryNode.appendChild(keyNode);
-                valueOf(keyNode, key);
+                valueOf(keyNode, me.getKey());
 
                 Node valueNode = entryNode.getOwnerDocument().createElementNS(null, "value");
                 entryNode.appendChild(valueNode);
-                valueOf(valueNode, v.get(key));
+                valueOf(valueNode, me.getValue());
             }
         }
     }

Mime
View raw message