Author: erwan
Date: Wed Mar 28 20:18:13 2012
New Revision: 1306568

URL: http://svn.apache.org/viewvc?rev=1306568&view=rev
Log:
Removing usage some more iterators

Modified:
    
ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/CachedClassLoader.java
    
ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CrossSubdomainSessionValve.java

Modified: 
ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java?rev=1306568&r1=1306567&r2=1306568&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
 (original)
+++ 
ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
 Wed Mar 28 20:18:13 2012
@@ -27,7 +27,6 @@ import java.net.URL;
 import java.nio.ByteBuffer;
 import java.sql.Timestamp;
 import java.util.Enumeration;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -757,8 +756,7 @@ public class CommunicationEventServices 
 
             //Get the first address from the list - this is the partyIdTo 
field of the CommunicationEvent
             if (!toParties.isEmpty()) {
-                Iterator<Map<String, Object>> itr = toParties.iterator();
-                Map<String, Object> firstAddressTo = itr.next();
+                Map<String, Object> firstAddressTo = toParties.get(0);
                 partyIdTo = (String)firstAddressTo.get("partyId");
                 contactMechIdTo = (String)firstAddressTo.get("contactMechId");
             }
@@ -1029,9 +1027,7 @@ public class CommunicationEventServices 
         // It's not clear what the "role" of this communication event should 
be, so we'll just put _NA_
         // check and see if this role was already created and ignore if true
         try {
-            Iterator<Map<String, Object>> it = parties.iterator();
-            while (it.hasNext()) {
-                Map<String, Object> result = it.next();
+            for(Map<String, Object> result : parties) {
                 String partyId = (String) result.get("partyId");
                 GenericValue commEventRole = 
delegator.findByPrimaryKey("CommunicationEventRole",
                         UtilMisc.toMap("communicationEventId", 
communicationEventId, "partyId", partyId, "roleTypeId", roleTypeId));
@@ -1053,9 +1049,7 @@ public class CommunicationEventServices 
     private static void createCommunicationEventWorkEffs(GenericValue 
userLogin, LocalDispatcher dispatcher, List<Map<String, Object>> 
workEffortInfos, String communicationEventId) {
         // create relationship between communication event and work efforts
         try {
-            Iterator<Map<String, Object>> it = workEffortInfos.iterator();
-            while (it.hasNext()) {
-                Map<String, Object> result = it.next();
+            for(Map<String, Object> result : workEffortInfos) {
                 String workEffortId = (String) result.get("workEffortId");
                 dispatcher.runSync("createCommunicationEventWorkEff", 
UtilMisc.toMap("workEffortId", workEffortId, "communicationEventId", 
communicationEventId, "userLogin", userLogin));
             }

Modified: 
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/CachedClassLoader.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/CachedClassLoader.java?rev=1306568&r1=1306567&r2=1306568&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/CachedClassLoader.java 
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/CachedClassLoader.java 
Wed Mar 28 20:18:13 2012
@@ -90,9 +90,7 @@ public class CachedClassLoader extends U
         registerClass(org.ofbiz.base.util.TimeDuration.class);
 
         ClassLoader loader = Thread.currentThread().getContextClassLoader();
-        Iterator<Init> cachedClassLoaders = ServiceLoader.load(Init.class, 
loader).iterator();
-        while (cachedClassLoaders.hasNext()) {
-            Init cachedClassLoader = cachedClassLoaders.next();
+        for(Init cachedClassLoader : ServiceLoader.load(Init.class, loader)) {
             try {
                 cachedClassLoader.loadClasses(loader);
             } catch (Exception e) {

Modified: 
ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CrossSubdomainSessionValve.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CrossSubdomainSessionValve.java?rev=1306568&r1=1306567&r2=1306568&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CrossSubdomainSessionValve.java
 (original)
+++ 
ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CrossSubdomainSessionValve.java
 Wed Mar 28 20:18:13 2012
@@ -50,8 +50,7 @@ public class CrossSubdomainSessionValve 
         // replace any Tomcat-generated session cookies with our own
         Cookie[] cookies = request.getCookies();
         if (cookies != null) {
-            for (int i = 0; i < cookies.length; i++) {
-                Cookie cookie = cookies[i];
+            for(Cookie cookie : cookies) {
                 if 
(SessionConfig.getSessionCookieName(null).equals(cookie.getName())) {
                     replaceCookie(request, response, cookie);
                 }


Reply via email to