james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matth...@apache.org
Subject svn commit: r1726771 [2/2] - in /james/project/trunk: mailbox/api/src/main/java/org/apache/james/mailbox/acl/ mailbox/api/src/main/java/org/apache/james/mailbox/model/ mailbox/api/src/test/java/org/apache/james/mailbox/ mailbox/hbase/src/main/java/org/...
Date Tue, 26 Jan 2016 10:49:50 GMT
Modified: james/project/trunk/protocols/api/src/test/java/org/apache/james/protocols/api/AbstractProtocolTransportTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/api/src/test/java/org/apache/james/protocols/api/AbstractProtocolTransportTest.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/api/src/test/java/org/apache/james/protocols/api/AbstractProtocolTransportTest.java (original)
+++ james/project/trunk/protocols/api/src/test/java/org/apache/james/protocols/api/AbstractProtocolTransportTest.java Tue Jan 26 10:49:49 2016
@@ -113,10 +113,9 @@ public class AbstractProtocolTransportTe
                     List<Response> responses = new ArrayList<Response>(messages);
                     if (reverse) {
                         Collections.reverse(responses);
-                    } 
-                    
-                    for (int i = 0; i < responses.size(); i++) {
-                        Response r = responses.get(i);
+                    }
+
+                    for (Response r : responses) {
                         if (r instanceof FutureResponseImpl) {
                             ((FutureResponseImpl) r).setResponse(new TestResponse());
                         }

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/api/display/CharsetUtil.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/api/display/CharsetUtil.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/api/display/CharsetUtil.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/api/display/CharsetUtil.java Tue Jan 26 10:49:49 2016
@@ -22,7 +22,6 @@ import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 import com.beetstra.jutf7.CharsetProvider;
@@ -47,8 +46,7 @@ public class CharsetUtil {
         Set<String>cNames = new HashSet<String>();
         Set<Charset> sets = new HashSet<Charset>();
 
-        for (final Iterator<Charset> it = Charset.availableCharsets().values().iterator(); it.hasNext();) {
-            final Charset charset = it.next();
+        for (Charset charset : Charset.availableCharsets().values()) {
             final Set<String> aliases = charset.aliases();
             cNames.add(charset.name());
             cNames.addAll(aliases);

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java Tue Jan 26 10:49:49 2016
@@ -173,9 +173,8 @@ public abstract class AbstractSelectionC
      */
     private void checkIdRanges(IdRange[] ranges, boolean checkOrder) throws DecodingException {
         long last = 0;
-        for (int i = 0; i < ranges.length; i++ ) {
-            
-            IdRange r = ranges[i];
+        for (IdRange r : ranges) {
+
             long low = r.getLowVal();
             long high = r.getHighVal();
             if (low == Long.MAX_VALUE || high == Long.MAX_VALUE) {

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java Tue Jan 26 10:49:49 2016
@@ -196,8 +196,7 @@ public class FetchResponseEncoder extend
             composer.openParen();
             final Set<String> keySet = params.keySet();
             final Collection<String> names = new TreeSet<String>(keySet);
-            for (Iterator<String> iter = names.iterator(); iter.hasNext();) {
-                final String name = iter.next();
+            for (final String name : names) {
                 final String value = params.get(name);
                 if (value == null) {
                     final Logger logger = session.getLog();
@@ -264,8 +263,7 @@ public class FetchResponseEncoder extend
 
     private void encodeBodyElements(final ImapResponseComposer composer, final List<FetchResponse.BodyElement> elements) throws IOException {
         if (elements != null) {
-            for (final Iterator<FetchResponse.BodyElement> it = elements.iterator(); it.hasNext();) {
-                FetchResponse.BodyElement element = it.next();
+            for (FetchResponse.BodyElement element : elements) {
                 final String name = element.getName();
                 composer.message(name);
                 composer.literal(element);
@@ -348,9 +346,7 @@ public class FetchResponseEncoder extend
             composer.nil();
         } else {
             composer.openParen();
-            final int length = addresses.length;
-            for (int i = 0; i < length; i++) {
-                final FetchResponse.Envelope.Address address = addresses[i];
+            for (FetchResponse.Envelope.Address address : addresses) {
                 encodeAddress(composer, address);
             }
             composer.closeParen();

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java Tue Jan 26 10:49:49 2016
@@ -21,7 +21,6 @@ package org.apache.james.imap.encode;
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.james.imap.api.ImapConstants;
@@ -43,8 +42,7 @@ public class ListingEncodingUtils {
         composer.message(responseTypeName);
         composer.openParen();
         if (attributes != null) {
-            for (Iterator<String> it = attributes.iterator(); it.hasNext();) {
-                final String attribute = it.next();
+            for (final String attribute : attributes) {
                 composer.message(attribute);
             }
         }

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/SearchResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/SearchResponseEncoder.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/SearchResponseEncoder.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/SearchResponseEncoder.java Tue Jan 26 10:49:49 2016
@@ -42,9 +42,7 @@ public class SearchResponseEncoder exten
         composer.untagged();
         composer.message(ImapConstants.SEARCH_RESPONSE_NAME);
         if (ids != null) {
-            final int length = ids.length;
-            for (int i = 0; i < length; i++) {
-                final long id = ids[i];
+            for (long id : ids) {
                 composer.message(id);
             }
         }

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java Tue Jan 26 10:49:49 2016
@@ -22,7 +22,6 @@ package org.apache.james.imap.encode;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Locale;
 
 import org.apache.james.imap.api.ImapCommand;
@@ -84,8 +83,7 @@ public class StatusResponseEncoder exten
             if (parameters != null && !parameters.isEmpty()) {
                 if (useParens)
                 	composer.openParen();
-                for (Iterator<String> it = parameters.iterator(); it.hasNext();) {
-                    final String parameter = it.next();
+                for (String parameter : parameters) {
                     composer.message(parameter);
                 }
                 if (useParens)

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java Tue Jan 26 10:49:49 2016
@@ -224,8 +224,8 @@ public class ImapResponseComposerImpl im
         }
         
         String[] userFlags = flags.getUserFlags();
-        for (int i = 0; i < userFlags.length; i++) {
-            message(userFlags[i]);
+        for (String userFlag : userFlags) {
+            message(userFlag);
         }
         closeParen();
         return this;

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java Tue Jan 26 10:49:49 2016
@@ -22,7 +22,6 @@ package org.apache.james.imap.processor;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.james.imap.api.ImapCommand;
@@ -214,11 +213,9 @@ abstract class AbstractSelectionProcesso
                         
                         // Add all uids which are contained in the knownuidsset to a List so we can later access them via the index
                         List<Long> knownUidsList = new ArrayList<Long>();
-                        for (int a = 0; a < knownUids.length; a++) {
-                            Iterator<Long> it =  knownUids[a].iterator();
-                            
-                            while(it.hasNext()) {
-                                knownUidsList.add(it.next());
+                        for (IdRange range : knownUids) {
+                            for (Long uid : range) {
+                                knownUidsList.add(uid);
                             }
                         }
                        
@@ -227,16 +224,15 @@ abstract class AbstractSelectionProcesso
                         // loop over the known sequences and check the UID for MSN X again the known UID X 
                         long firstUid = 1;
                         int index = 0;
-                        for (int a = 0; a < knownSequences.length; a++) {
+                        for (IdRange knownSequence : knownSequences) {
                             boolean done = false;
-                            Iterator<Long> it =  knownSequences[a].iterator();
-                            while(it.hasNext()) {
-                                
+                            for (Long uid : knownSequence) {
+
                                 // Check if we have uids left to check against
                                 if (knownUidsList.size() > index++) {
-                                    int msn = it.next().intValue();
+                                    int msn = uid.intValue();
                                     long knownUid = knownUidsList.get(index);
-                                    
+
                                     // Check if the uid mathc if not we are done here
                                     if (selected.uid(msn) != knownUid) {
                                         done = true;
@@ -244,22 +240,21 @@ abstract class AbstractSelectionProcesso
                                     } else {
                                         firstUid = knownUid;
                                     }
-                                    
+
                                 } else {
                                     done = true;
                                     break;
                                 }
 
                             }
-                            
+
                             // We found the first uid to start with 
                             if (done) {
                                 firstUid++;
-                                
+
                                 // Ok now its time to filter out the IdRanges which we are not interested in
                                 List<IdRange> filteredUidSet = new ArrayList<IdRange>();
-                                for ( int i = 0; i < uidSet.length; i++) {
-                                    IdRange r = uidSet[i];
+                                for (IdRange r : uidSet) {
                                     if (r.getLowVal() < firstUid) {
                                         if (r.getHighVal() > firstUid) {
                                             r.setLowVal(firstUid);
@@ -270,7 +265,7 @@ abstract class AbstractSelectionProcesso
                                     }
                                 }
                                 uidSet = filteredUidSet.toArray(new IdRange[0]);
-                                
+
                                 break;
                             }
                         }
@@ -279,8 +274,8 @@ abstract class AbstractSelectionProcesso
                     }
                     
                     List<MessageRange> ranges = new ArrayList<MessageRange>();
-                    for (int i = 0; i < uidSet.length; i++) {
-                        MessageRange messageSet = messageRange(session.getSelected(), uidSet[i], true);
+                    for (IdRange range : uidSet) {
+                        MessageRange messageSet = messageRange(session.getSelected(), range, true);
                         if (messageSet != null) {
                             MessageRange normalizedMessageSet = normalizeMessageRange(session.getSelected(), messageSet);
                             ranges.add(normalizedMessageSet);
@@ -429,8 +424,7 @@ abstract class AbstractSelectionProcesso
 
     private void addRecent(final MessageManager.MetaData metaData, SelectedMailbox sessionMailbox) throws MailboxException {
         final List<Long> recentUids = metaData.getRecent();
-        for (int i = 0; i < recentUids.size(); i++) {
-            long uid = recentUids.get(i);
+        for (Long uid : recentUids) {
             sessionMailbox.addRecent(uid);
         }
     }

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java Tue Jan 26 10:49:49 2016
@@ -115,8 +115,8 @@ public class CapabilityProcessor extends
      */
     public static Set<String> getSupportedCapabilities(ImapSession session) {
         Set<String> caps = new HashSet<String>();
-        for (int i = 0; i < capabilities.size(); i++) {
-            caps.addAll(capabilities.get(i).getImplementedCapabilities(session));
+        for (CapabilityImplementingProcessor capability : capabilities) {
+            caps.addAll(capability.getImplementedCapabilities(session));
         }
         caps.removeAll(disabledCaps);
         return caps;

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/CopyProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/CopyProcessor.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/CopyProcessor.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/CopyProcessor.java Tue Jan 26 10:49:49 2016
@@ -75,12 +75,12 @@ public class CopyProcessor extends Abstr
                 final MessageManager mailbox = mailboxManager.getMailbox(targetMailbox, mailboxSession);
 
                 List<IdRange> resultRanges = new ArrayList<IdRange>();
-                for (int i = 0; i < idSet.length; i++) {
-                    MessageRange messageSet = messageRange(currentMailbox, idSet[i], useUids);
+                for (IdRange range : idSet) {
+                    MessageRange messageSet = messageRange(currentMailbox, range, useUids);
                     if (messageSet != null) {
                         List<MessageRange> processedUids = process(
-								targetMailbox, currentMailbox, mailboxSession,
-								mailboxManager, messageSet);
+                            targetMailbox, currentMailbox, mailboxSession,
+                            mailboxManager, messageSet);
                         for (MessageRange mr : processedUids) {
                             // Set recent flag on copied message as this SHOULD be
                             // done.

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java Tue Jan 26 10:49:49 2016
@@ -86,8 +86,7 @@ public class EnableProcessor extends Abs
             String cap = caps.next();
             // Check if the CAPABILITY is supported at all
             if (CapabilityProcessor.getSupportedCapabilities(session).contains(cap)) {
-                for (int a = 0; a < capabilities.size(); a++) {
-                    PermitEnableCapabilityProcessor enableProcessor = capabilities.get(a);
+                for (PermitEnableCapabilityProcessor enableProcessor : capabilities) {
                     if (enableProcessor.getPermitEnableCapabilities(session).contains(cap)) {
                         enableProcessor.enable(request, responder, session, cap);
                         enabledCaps.add(cap);

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java Tue Jan 26 10:49:49 2016
@@ -69,8 +69,8 @@ public class ExpungeProcessor extends Ab
                 } else {
                     // Handle UID EXPUNGE which is part of UIDPLUS
                     // See http://tools.ietf.org/html/rfc4315
-                    for (int i = 0; i < ranges.length; i++) {
-                        MessageRange mRange = messageRange(session.getSelected(), ranges[i], true);
+                    for (IdRange range : ranges) {
+                        MessageRange mRange = messageRange(session.getSelected(), range, true);
                         if (mRange != null) {
                             expunged += expunge(mailbox, mRange, session, mailboxSession);
                         }

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java Tue Jan 26 10:49:49 2016
@@ -133,8 +133,8 @@ public class SearchProcessor extends Abs
             } else {
                 IdRange[] idRanges;
                 List<Long> idList = new ArrayList<Long>(ids.length);
-                for ( int i = 0; i < ids.length; i++) {
-                    idList.add(ids[i]);
+                for (long id : ids) {
+                    idList.add(id);
                 }
                 List<MessageRange> ranges = MessageRange.toRanges(idList);
                 idRanges = new IdRange[ranges.size()];
@@ -144,8 +144,8 @@ public class SearchProcessor extends Abs
                 }
                 
                 boolean esearch = false;
-                for (int i = 0; i < resultOptions.size(); i++) {
-                    if (SearchResultOption.SAVE != resultOptions.get(i)) {
+                for (SearchResultOption resultOption : resultOptions) {
+                    if (SearchResultOption.SAVE != resultOption) {
                         esearch = true;
                         break;
                     }
@@ -390,7 +390,6 @@ public class SearchProcessor extends Abs
      * @throws MessageRangeException
      */
     private Criterion sequence(IdRange[] sequenceNumbers, final ImapSession session, boolean msn) throws MessageRangeException {
-        final int length = sequenceNumbers.length;
         final List<SearchQuery.NumericRange> ranges = new ArrayList<SearchQuery.NumericRange>();
         final SelectedMailbox selected = session.getSelected();
         boolean useUids = !msn;
@@ -398,9 +397,7 @@ public class SearchProcessor extends Abs
         // First of check if we have any messages in the mailbox
         // if not we don't need to go through all of this
         if (selected.existsCount() > 0) {
-            for (int i = 0; i < length; i++) {
-                final IdRange range = sequenceNumbers[i];
-
+            for (final IdRange range : sequenceNumbers) {
                 long lowVal = range.getLowVal();
                 long highVal = range.getHighVal();
                 if (useUids) {

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java Tue Jan 26 10:49:49 2016
@@ -108,24 +108,24 @@ public class StoreProcessor extends Abst
             } 
             final List<Long> failed = new ArrayList<Long>();
             final List<String> userFlags = Arrays.asList(flags.getUserFlags());
-            for (int i = 0; i < idSet.length; i++) {
+            for (IdRange range : idSet) {
                 final SelectedMailbox selected = session.getSelected();
-                MessageRange messageSet = messageRange(selected, idSet[i], useUids);
+                MessageRange messageSet = messageRange(selected, range, useUids);
                 if (messageSet != null) {
-                    
+
                     if (unchangedSince != -1) {
                         // Ok we have a CONDSTORE option so use the CONDSTORE_COMMAND
                         imapCommand = CONDSTORE_COMMAND;
-                        
+
                         List<Long> uids = new ArrayList<Long>();
 
                         MessageResultIterator results = mailbox.getMessages(messageSet, FetchGroupImpl.MINIMAL, mailboxSession);
-                        while(results.hasNext()) {
+                        while (results.hasNext()) {
                             MessageResult r = results.next();
                             long uid = r.getUid();
-                            
+
                             boolean fail = false;
-                            
+
                             // Check if UNCHANGEDSINCE 0 was used and the Message contains the request flag.
                             // In such cases we need to fail for this message.
                             //
@@ -135,16 +135,16 @@ public class StoreProcessor extends Abst
                             //       considered existent, whether it was set or not.
                             if (unchangedSince == 0) {
                                 String[] uFlags = r.getFlags().getUserFlags();
-                                for (int a = 0; a < uFlags.length; a++) {
-                                    if (userFlags.contains(uFlags[a])) {
+                                for (String uFlag : uFlags) {
+                                    if (userFlags.contains(uFlag)) {
                                         fail = true;
                                         break;
                                     }
                                 }
                             }
-                            
+
                             // Check if the mod-sequence of the message is <= the unchangedsince.
-                            // 
+                            //
                             // See RFC4551 3.2. STORE and UID STORE Commands
                             if (!fail && r.getModSeq() <= unchangedSince) {
                                 uids.add(uid);
@@ -157,16 +157,16 @@ public class StoreProcessor extends Abst
                             }
                         }
                         List<MessageRange> mRanges = MessageRange.toRanges(uids);
-                        for (int a = 0 ; a < mRanges.size(); a++) {
-                            setFlags(request, mailboxSession, mailbox, mRanges.get(a), session, tag, imapCommand, responder);
+                        for (MessageRange mRange : mRanges) {
+                            setFlags(request, mailboxSession, mailbox, mRange, session, tag, imapCommand, responder);
                         }
                     } else {
                         setFlags(request, mailboxSession, mailbox, messageSet, session, tag, imapCommand, responder);
                     }
-                    
+
                 }
 
-                
+
             }
             final boolean omitExpunged = (!useUids);
             unsolicitedResponses(session, responder, omitExpunged, useUids);

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java Tue Jan 26 10:49:49 2016
@@ -452,21 +452,17 @@ public class SelectedMailboxImpl impleme
                 if (messageEvent instanceof Added) {
                     sizeChanged = true;
                     final List<Long> uids = ((Added) event).getUids();
-                    for (int i = 0; i < uids.size(); i++) {
-                        add(uids.get(i));
+                    for (Long uid : uids) {
+                        add(uid);
                     }
                 } else if (messageEvent instanceof FlagsUpdated) {
                     FlagsUpdated updated = (FlagsUpdated) messageEvent;
                     List<UpdatedFlags> uFlags = updated.getUpdatedFlags();
                     if (sessionId != eventSessionId || !silentFlagChanges) {
 
-                        for (int i = 0; i < uFlags.size(); i++) {
-                            UpdatedFlags u = uFlags.get(i);
-
+                        for (UpdatedFlags u : uFlags) {
                             if (interestingFlags(u)) {
-
                                 flagUpdateUids.add(u.getUid());
-
                             }
                         }
                     }
@@ -478,8 +474,7 @@ public class SelectedMailboxImpl impleme
                         // \RECENT flag
                         // See IMAP-287
                         List<UpdatedFlags> uflags = updated.getUpdatedFlags();
-                        for (int i = 0; i < uflags.size(); i++) {
-                            UpdatedFlags u = uflags.get(i);
+                        for (UpdatedFlags u : uflags) {
                             Iterator<Flag> flags = u.systemFlagIterator();
 
                             while (flags.hasNext()) {
@@ -490,7 +485,7 @@ public class SelectedMailboxImpl impleme
                                     }
                                 }
                             }
-                          
+
 
                         }
                     }
@@ -499,8 +494,8 @@ public class SelectedMailboxImpl impleme
                     FlagsUpdated updatedF = (FlagsUpdated) messageEvent;
                     List<UpdatedFlags> flags = updatedF.getUpdatedFlags();
 
-                    for (int i = 0; i < flags.size(); i++) {
-                        applicableFlags.add(flags.get(i).getNewFlags());
+                    for (UpdatedFlags flag : flags) {
+                        applicableFlags.add(flag.getNewFlags());
 
                     }
 

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java Tue Jan 26 10:49:49 2016
@@ -38,6 +38,7 @@ import org.apache.james.mime4j.dom.addre
 import org.apache.james.mime4j.dom.address.AddressList;
 import org.apache.james.mime4j.dom.address.DomainList;
 import org.apache.james.mime4j.dom.address.Group;
+import org.apache.james.mime4j.dom.address.Mailbox;
 import org.apache.james.mime4j.dom.address.MailboxList;
 import org.apache.james.mime4j.field.address.LenientAddressParser;
 import org.slf4j.Logger;
@@ -133,14 +134,13 @@ public final class EnvelopeBuilder {
                 AddressList addressList = LenientAddressParser.DEFAULT.parseAddressList(value);
                 final int size = addressList.size();
                 final List<FetchResponse.Envelope.Address> addresses = new ArrayList<FetchResponse.Envelope.Address>(size);
-                for (int i = 0; i < size; i++) {
-                    final Address address = addressList.get(i);
+                for (Address address : addressList) {
                     if (address instanceof Group) {
                         final Group group = (Group) address;
                         addAddresses(group, addresses);
 
-                    } else if (address instanceof org.apache.james.mime4j.dom.address.Mailbox) {
-                        final org.apache.james.mime4j.dom.address.Mailbox mailbox = (org.apache.james.mime4j.dom.address.Mailbox) address;
+                    } else if (address instanceof Mailbox) {
+                        final Mailbox mailbox = (Mailbox) address;
                         final FetchResponse.Envelope.Address mailboxAddress = buildMailboxAddress(mailbox);
                         addresses.add(mailboxAddress);
 
@@ -149,7 +149,7 @@ public final class EnvelopeBuilder {
                     }
                 }
 
-                results = (FetchResponse.Envelope.Address[]) addresses.toArray(FetchResponse.Envelope.Address.EMPTY);
+                results = addresses.toArray(FetchResponse.Envelope.Address.EMPTY);
                 
 
             }
@@ -182,8 +182,7 @@ public final class EnvelopeBuilder {
         final FetchResponse.Envelope.Address start = startGroup(groupName);
         addresses.add(start);
         final MailboxList mailboxList = group.getMailboxes();
-        for (int i = 0; i < mailboxList.size(); i++) {
-            final org.apache.james.mime4j.dom.address.Mailbox mailbox = mailboxList.get(i);
+        for (Mailbox mailbox : mailboxList) {
             final FetchResponse.Envelope.Address address = buildMailboxAddress(mailbox);
             addresses.add(address);
         }

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java Tue Jan 26 10:49:49 2016
@@ -21,7 +21,6 @@ package org.apache.james.imap.processor.
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.james.imap.api.ImapCommand;
@@ -98,8 +97,8 @@ public class FetchProcessor extends Abst
             
             List<MessageRange> ranges = new ArrayList<MessageRange>();
 
-            for (int i = 0; i < idSet.length; i++) {
-                MessageRange messageSet = messageRange(session.getSelected(), idSet[i], useUids);
+            for (IdRange range : idSet) {
+                MessageRange messageSet = messageRange(session.getSelected(), range, useUids);
                 if (messageSet != null) {
                     MessageRange normalizedMessageSet = normalizeMessageRange(session.getSelected(), messageSet);
                     MessageRange batchedMessageSet = MessageRange.range(normalizedMessageSet.getUidFrom(), normalizedMessageSet.getUidTo());
@@ -156,16 +155,16 @@ public class FetchProcessor extends Abst
         final FetchResponseBuilder builder = new FetchResponseBuilder(new EnvelopeBuilder(session.getLog()));
         FetchGroup resultToFetch = getFetchGroup(fetch);
 
-        for (int i = 0; i < ranges.size(); i++) {
-            MessageResultIterator messages = mailbox.getMessages(ranges.get(i), resultToFetch, mailboxSession);
+        for (MessageRange range : ranges) {
+            MessageResultIterator messages = mailbox.getMessages(range, resultToFetch, mailboxSession);
             while (messages.hasNext()) {
                 final MessageResult result = messages.next();
-                
+
                 //skip unchanged messages - this should be filtered at the mailbox level to take advantage of indexes
-                if(fetch.isModSeq() && result.getModSeq() <= fetch.getChangedSince()) {
-                	continue;
+                if (fetch.isModSeq() && result.getModSeq() <= fetch.getChangedSince()) {
+                    continue;
                 }
-                
+
                 try {
                     final FetchResponse response = builder.build(fetch, result, mailbox, session, useUids);
                     responder.respond(response);
@@ -185,10 +184,10 @@ public class FetchProcessor extends Abst
                     }
                 }
             }
-            
+
             // Throw the exception if we received one
             if (messages.getException() != null) {
-            	throw messages.getException();
+                throw messages.getException();
             }
         }
 
@@ -206,32 +205,31 @@ public class FetchProcessor extends Abst
 
         Collection<BodyFetchElement> bodyElements = fetch.getBodyElements();
         if (bodyElements != null) {
-            for (final Iterator<BodyFetchElement> it = bodyElements.iterator(); it.hasNext();) {
-                final BodyFetchElement element = it.next();
+            for (final BodyFetchElement element : bodyElements) {
                 final int sectionType = element.getSectionType();
                 final int[] path = element.getPath();
                 final boolean isBase = (path == null || path.length == 0);
                 switch (sectionType) {
-                case BodyFetchElement.CONTENT:
-                    if (isBase) {
-                        addContent(result, path, isBase, MessageResult.FetchGroup.FULL_CONTENT);
-                    } else {
-                        addContent(result, path, isBase, MessageResult.FetchGroup.MIME_CONTENT);
-                    }
-                    break;
-                case BodyFetchElement.HEADER:
-                case BodyFetchElement.HEADER_NOT_FIELDS:
-                case BodyFetchElement.HEADER_FIELDS:
-                    addContent(result, path, isBase, MessageResult.FetchGroup.HEADERS);
-                    break;
-                case BodyFetchElement.MIME:
-                    addContent(result, path, isBase, MessageResult.FetchGroup.MIME_HEADERS);
-                    break;
-                case BodyFetchElement.TEXT:
-                    addContent(result, path, isBase, MessageResult.FetchGroup.BODY_CONTENT);
-                    break;
-                default:
-                    break;
+                    case BodyFetchElement.CONTENT:
+                        if (isBase) {
+                            addContent(result, path, isBase, FetchGroup.FULL_CONTENT);
+                        } else {
+                            addContent(result, path, isBase, FetchGroup.MIME_CONTENT);
+                        }
+                        break;
+                    case BodyFetchElement.HEADER:
+                    case BodyFetchElement.HEADER_NOT_FIELDS:
+                    case BodyFetchElement.HEADER_FIELDS:
+                        addContent(result, path, isBase, FetchGroup.HEADERS);
+                        break;
+                    case BodyFetchElement.MIME:
+                        addContent(result, path, isBase, FetchGroup.MIME_HEADERS);
+                        break;
+                    case BodyFetchElement.TEXT:
+                        addContent(result, path, isBase, FetchGroup.BODY_CONTENT);
+                        break;
+                    default:
+                        break;
                 }
 
             }

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java Tue Jan 26 10:49:49 2016
@@ -152,8 +152,7 @@ public final class FetchResponseBuilder
         // BODY part responses.
         Collection<BodyFetchElement> elements = fetch.getBodyElements();
         this.elements = new ArrayList<FetchResponse.BodyElement>();
-        for (Iterator<BodyFetchElement> iterator = elements.iterator(); iterator.hasNext();) {
-            BodyFetchElement fetchElement = iterator.next();
+        for (BodyFetchElement fetchElement : elements) {
             final FetchResponse.BodyElement element = bodyFetch(result, fetchElement);
             if (element != null) {
                 this.elements.add(element);

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MessageResultUtils.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MessageResultUtils.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MessageResultUtils.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MessageResultUtils.java Tue Jan 26 10:49:49 2016
@@ -70,9 +70,7 @@ public class MessageResultUtils {
                 MessageResult.Header header = iterator.next();
                 final String headerName = header.getName();
                 if (headerName != null) {
-                    final int length = names.length;
-                    for (int i = 0; i < length; i++) {
-                        final String name = names[i];
+                    for (final String name : names) {
                         if (headerName.equalsIgnoreCase(name)) {
                             results.add(header);
                             break;
@@ -119,8 +117,7 @@ public class MessageResultUtils {
         boolean match = false;
         final String headerName = header.getName();
         if (headerName != null) {
-            for (final Iterator<String> it = names.iterator(); it.hasNext();) {
-                final String name = it.next();
+            for (final String name : names) {
                 if (name.equalsIgnoreCase(headerName)) {
                     match = true;
                     break;
@@ -192,10 +189,8 @@ public class MessageResultUtils {
                 MessageResult.Header header = iterator.next();
                 final String headerName = header.getName();
                 if (headerName != null) {
-                    final int length = names.length;
                     boolean match = false;
-                    for (int i = 0; i < length; i++) {
-                        final String name = names[i];
+                    for (String name : names) {
                         if (headerName.equalsIgnoreCase(name)) {
                             match = true;
                             break;

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimeBodyElement.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimeBodyElement.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimeBodyElement.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimeBodyElement.java Tue Jan 26 10:49:49 2016
@@ -23,7 +23,6 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.Charset;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.james.imap.api.ImapConstants;
@@ -68,8 +67,7 @@ public class MimeBodyElement implements
            result = 0;
         } else {
             int count = 0;
-            for (final Iterator<MessageResult.Header> it = headers.iterator(); it.hasNext();) {
-                MessageResult.Header header = it.next();
+            for (MessageResult.Header header : headers) {
                 count += header.size() + ImapConstants.LINE_END.length();
             }
             result = count + ImapConstants.LINE_END.length();
@@ -92,8 +90,7 @@ public class MimeBodyElement implements
     public InputStream getInputStream() throws IOException {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
 
-        for (final Iterator<MessageResult.Header> it = headers.iterator(); it.hasNext();) {
-            MessageResult.Header header = it.next();
+        for (MessageResult.Header header : headers) {
             try {
                 out.write((header.getName() + ": " + header.getValue() + ImapConstants.LINE_END).getBytes(US_ASCII));
             } catch (MailboxException e) {

Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimePathImpl.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimePathImpl.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimePathImpl.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimePathImpl.java Tue Jan 26 10:49:49 2016
@@ -61,13 +61,13 @@ final class MimePathImpl implements Mess
     public String toString() {
         final StringBuffer buffer = new StringBuffer("MIMEPath:");
         boolean isFirst = false;
-        for (int i = 0; i < positions.length; i++) {
+        for (int position : positions) {
             if (isFirst) {
                 isFirst = false;
             } else {
                 buffer.append('.');
             }
-            buffer.append(positions[i]);
+            buffer.append(position);
         }
         return buffer.toString();
     }

Modified: james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java (original)
+++ james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java Tue Jan 26 10:49:49 2016
@@ -185,29 +185,29 @@ public class FetchPartPathDecoderTest {
 
     private void checkReadNames(String base, String[] names) throws Exception {
         base = base + " (";
-        for (int i = 0; i < names.length; i++) {
-            base = base + ' ' + names[i];
+        for (String name : names) {
+            base = base + ' ' + name;
         }
         base = base + ')';
         decoder.decode(base);
         Collection<String> results = decoder.getNames();
         assertNotNull(results);
         Iterator<String> it = results.iterator();
-        for (int i = 0; i < names.length; i++) {
-            assertEquals(names[i], it.next());
+        for (String name : names) {
+            assertEquals(name, it.next());
         }
     }
 
     private void checkEndingPermutations(int[] values) throws Exception {
         String base = "";
         boolean first = true;
-        for (int i = 0; i < values.length; i++) {
+        for (int value : values) {
             if (first) {
                 first = false;
             } else {
                 base = base + ".";
             }
-            base = base + values[i];
+            base = base + value;
         }
         checkPath(values, base);
         checkPath(values, base + ".TEXT");

Modified: james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java (original)
+++ james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java Tue Jan 26 10:49:49 2016
@@ -176,14 +176,14 @@ public class SearchCommandParserTopLevel
             check(keys, buffer);
         } else {
             mutations -= 1;
-            for (int i = 0; i < inputs.length; i++) {
+            for (Input input : inputs) {
                 StringBuffer nextBuffer = new StringBuffer(buffer.toString());
                 if (nextBuffer.length() > 0) {
                     nextBuffer.append(' ');
                 }
-                nextBuffer.append(inputs[i].input);
+                nextBuffer.append(input.input);
                 List<SearchKey> nextKeys = new ArrayList<SearchKey>(keys);
-                nextKeys.add(inputs[i].key);
+                nextKeys.add(input.key);
                 permute(mutations, nextKeys, nextBuffer, inputs);
             }
         }

Modified: james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/main/AbstractTestOutputStreamImapResponseWriter.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/main/AbstractTestOutputStreamImapResponseWriter.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/main/AbstractTestOutputStreamImapResponseWriter.java (original)
+++ james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/main/AbstractTestOutputStreamImapResponseWriter.java Tue Jan 26 10:49:49 2016
@@ -47,8 +47,8 @@ public abstract class AbstractTestOutput
         writer.flush();
         out.flush();
         byte[] output = out.toByteArray();
-        for (int i = 0; i < output.length; i++) {
-            buffer.append((char) output[i]);
+        for (byte aChar : output) {
+            buffer.append((char) aChar);
         }
         assertEquals(expected, buffer.toString());
     }

Modified: james/project/trunk/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java (original)
+++ james/project/trunk/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java Tue Jan 26 10:49:49 2016
@@ -27,8 +27,8 @@ import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.net.smtp.RelayPath;
 import org.apache.commons.net.smtp.SMTPClient;
 import org.apache.commons.net.smtp.SMTPReply;
@@ -56,12 +56,11 @@ public abstract class AbstractLMTPServer
     protected Protocol createProtocol(ProtocolHandler... handlers) throws WiringException {
         LMTPProtocolHandlerChain chain = new LMTPProtocolHandlerChain();
         List<ProtocolHandler> hList = new ArrayList<ProtocolHandler>();
-        
-        for (int i = 0; i < handlers.length; i++) {
-            ProtocolHandler handler = handlers[i];
+
+        for (ProtocolHandler handler : handlers) {
             if (handler instanceof MessageHook) {
                 handler = new MessageHookAdapter((MessageHook) handler);
-            } 
+            }
             hList.add(handler);
         }
         chain.addAll(0, hList);
@@ -330,16 +329,16 @@ public abstract class AbstractLMTPServer
             } 
             return result;
         }
-
-        @Override
-        public void init(Configuration config) throws ConfigurationException {
-
-        }
-
-        @Override
-        public void destroy() {
-
-        }
+
+        @Override
+        public void init(Configuration config) throws ConfigurationException {
+
+        }
+
+        @Override
+        public void destroy() {
+
+        }
     }
     
     private final class TestDeliverHook implements DeliverToRecipientHook {
@@ -362,16 +361,16 @@ public abstract class AbstractLMTPServer
         public List<MailEnvelope> getDelivered() {
             return delivered;
         }
-
-        @Override
-        public void init(Configuration config) throws ConfigurationException {
-
-        }
-
-        @Override
-        public void destroy() {
-
-        }
-    }
+
+        @Override
+        public void init(Configuration config) throws ConfigurationException {
+
+        }
+
+        @Override
+        public void destroy() {
+
+        }
+    }
 
 }

Modified: james/project/trunk/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java (original)
+++ james/project/trunk/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java Tue Jan 26 10:49:49 2016
@@ -96,9 +96,9 @@ public abstract class AbstractAsyncServe
         // Configure the pipeline factory.
         bootstrap.setPipelineFactory(factory);
         configureBootstrap(bootstrap);
-        
-        for (int i = 0; i < addresses.size();i++) {
-            channels.add(bootstrap.bind(addresses.get(i)));
+
+        for (InetSocketAddress address : addresses) {
+            channels.add(bootstrap.bind(address));
         }
         started = true;
 

Modified: james/project/trunk/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelUpstreamHandler.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelUpstreamHandler.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelUpstreamHandler.java (original)
+++ james/project/trunk/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelUpstreamHandler.java Tue Jan 26 10:49:49 2016
@@ -86,26 +86,24 @@ public class BasicChannelUpstreamHandler
         ProtocolSession session = (ProtocolSession) ctx.getAttachment();
         session.getLogger().info("Connection established from " + session.getRemoteAddress().getAddress().getHostAddress());
         if (connectHandlers != null) {
-            for (int i = 0; i < connectHandlers.size(); i++) {
-                ConnectHandler cHandler = connectHandlers.get(i);
-                
+            for (ConnectHandler cHandler : connectHandlers) {
                 long start = System.currentTimeMillis();
-                Response response = connectHandlers.get(i).onConnect(session);
+                Response response = cHandler.onConnect(session);
                 long executionTime = System.currentTimeMillis() - start;
-                
-                for (int a = 0; a < resultHandlers.size(); a++) {
+
+                for (ProtocolHandlerResultHandler resultHandler : resultHandlers) {
                     // Disable till PROTOCOLS-37 is implemented
                     if (response instanceof FutureResponse) {
                         session.getLogger().debug("ProtocolHandlerResultHandler are not supported for FutureResponse yet");
                         break;
-                    } 
-                    resultHandlers.get(a).onResponse(session, response, executionTime, cHandler);
+                    }
+                    resultHandler.onResponse(session, response, executionTime, cHandler);
                 }
                 if (response != null) {
                     // TODO: This kind of sucks but I was able to come up with something more elegant here
-                    ((ProtocolSessionImpl)session).getProtocolTransport().writeResponse(response, session);
+                    ((ProtocolSessionImpl) session).getProtocolTransport().writeResponse(response, session);
                 }
-               
+
             }
         }
         super.channelConnected(ctx, e);
@@ -119,8 +117,8 @@ public class BasicChannelUpstreamHandler
         List<DisconnectHandler> connectHandlers = chain.getHandlers(DisconnectHandler.class);
         ProtocolSession session = (ProtocolSession) ctx.getAttachment();
         if (connectHandlers != null) {
-            for (int i = 0; i < connectHandlers.size(); i++) {
-                connectHandlers.get(i).onDisconnect(session);
+            for (DisconnectHandler connectHandler : connectHandlers) {
+                connectHandler.onDisconnect(session);
             }
         }
         super.channelDisconnected(ctx, e);
@@ -147,13 +145,13 @@ public class BasicChannelUpstreamHandler
             Response response = lHandler.onLine(pSession,buf.toByteBuffer());
             long executionTime = System.currentTimeMillis() - start;
 
-            for (int i = 0; i < resultHandlers.size(); i++) {
+            for (ProtocolHandlerResultHandler resultHandler : resultHandlers) {
                 // Disable till PROTOCOLS-37 is implemented
                 if (response instanceof FutureResponse) {
                     pSession.getLogger().debug("ProtocolHandlerResultHandler are not supported for FutureResponse yet");
                     break;
-                } 
-                response = resultHandlers.get(i).onResponse(pSession, response, executionTime, lHandler);
+                }
+                response = resultHandler.onResponse(pSession, response, executionTime, lHandler);
             }
             if (response != null) {
                 // TODO: This kind of sucks but I was able to come up with something more elegant here

Modified: james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/CapaCmdHandler.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/CapaCmdHandler.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/CapaCmdHandler.java (original)
+++ james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/CapaCmdHandler.java Tue Jan 26 10:49:49 2016
@@ -64,8 +64,8 @@ public class CapaCmdHandler implements C
     public Response onCommand(POP3Session session, Request request) {
         POP3Response response = new POP3Response(POP3Response.OK_RESPONSE, "Capability list follows");
 
-        for (int i = 0; i < caps.size(); i++) {
-            for (String cap: caps.get(i).getImplementedCapabilities(session)) {
+        for (CapaCapability capabilities : caps) {
+            for (String cap : capabilities.getImplementedCapabilities(session)) {
                 response.appendLine(cap);
             }
         }

Modified: james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/ListCmdHandler.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/ListCmdHandler.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/ListCmdHandler.java (original)
+++ james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/ListCmdHandler.java Tue Jan 26 10:49:49 2016
@@ -25,8 +25,8 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.james.protocols.api.ProtocolSession.State;
 import org.apache.james.protocols.api.Request;
 import org.apache.james.protocols.api.Response;
@@ -39,19 +39,19 @@ import org.apache.james.protocols.pop3.m
  * Handles LIST command
  */
 public class ListCmdHandler implements CommandHandler<POP3Session> {
-
+
     private static final Collection<String> COMMANDS = Collections.unmodifiableCollection(Arrays.asList("LIST"));
 
-    @Override
-    public void init(Configuration config) throws ConfigurationException {
-
-    }
-
-    @Override
-    public void destroy() {
-
-    }
-
+    @Override
+    public void init(Configuration config) throws ConfigurationException {
+
+    }
+
+    @Override
+    public void destroy() {
+
+    }
+
     /**
      * Handler method called upon receipt of a LIST command. Returns the number
      * of messages in the mailbox and its aggregate size, or optionally, the
@@ -79,8 +79,7 @@ public class ListCmdHandler implements C
                 List<MessageMetaData> validResults = new ArrayList<MessageMetaData>();
                 if (uidList.isEmpty() == false) {
 
-                    for (int i = 0; i < uidList.size(); i++) {
-                        MessageMetaData data = uidList.get(i);
+                    for (MessageMetaData data : uidList) {
                         if (deletedUidList.contains(data.getUid()) == false) {
                             size += data.getSize();
                             count++;

Modified: james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/StatCmdHandler.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/StatCmdHandler.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/StatCmdHandler.java (original)
+++ james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/StatCmdHandler.java Tue Jan 26 10:49:49 2016
@@ -25,8 +25,8 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.james.protocols.api.Request;
 import org.apache.james.protocols.api.Response;
 import org.apache.james.protocols.api.ProtocolSession.State;
@@ -41,16 +41,16 @@ import org.apache.james.protocols.pop3.m
 public class StatCmdHandler implements CommandHandler<POP3Session> {
     private static final Collection<String> COMMANDS = Collections.unmodifiableCollection(Arrays.asList("STAT"));
 
-    @Override
-    public void init(Configuration config) throws ConfigurationException {
-
-    }
-
-    @Override
-    public void destroy() {
-
-    }
-
+    @Override
+    public void init(Configuration config) throws ConfigurationException {
+
+    }
+
+    @Override
+    public void destroy() {
+
+    }
+
     /**
      * Handler method called upon receipt of a STAT command. Returns the number
      * of messages in the mailbox and its aggregate size.
@@ -65,8 +65,7 @@ public class StatCmdHandler implements C
             int count = 0;
             if (uidList.isEmpty() == false) {
                 List<MessageMetaData> validResults = new ArrayList<MessageMetaData>();
-                for (int i = 0; i < uidList.size(); i++) {
-                    MessageMetaData data = uidList.get(i);
+                for (MessageMetaData data : uidList) {
                     if (deletedUidList.contains(data.getUid()) == false) {
                         size += data.getSize();
                         count++;

Modified: james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/MailAddress.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/MailAddress.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/MailAddress.java (original)
+++ james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/MailAddress.java Tue Jan 26 10:49:49 2016
@@ -363,9 +363,9 @@ public class MailAddress {
                 if (c <= 31 || c >= 127 || c == ' ') {
                     throw new MailAddressException("Invalid character in local-part (user account) at position " + (pos + 1) + " in '" + address + "'",address,pos+1);
                 }
-                for (int i = 0; i < SPECIAL.length; i++) {
-                    if (c == SPECIAL[i]) {
-                        throw new MailAddressException("Invalid character in local-part (user account) at position " + (pos + 1) + " in '" + address + "'",address,pos+1);
+                for (char aChar : SPECIAL) {
+                    if (c == aChar) {
+                        throw new MailAddressException("Invalid character in local-part (user account) at position " + (pos + 1) + " in '" + address + "'", address, pos + 1);
                     }
                 }
                 resultSB.append(c);

Modified: james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPProtocolHandlerChain.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPProtocolHandlerChain.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPProtocolHandlerChain.java (original)
+++ james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPProtocolHandlerChain.java Tue Jan 26 10:49:49 2016
@@ -77,9 +77,9 @@ public class SMTPProtocolHandlerChain ex
      * @throws WiringException
      */
     public SMTPProtocolHandlerChain(Hook... hooks) throws WiringException {
-        this(true);    
-        for (int i = 0; i < hooks.length; i++) {
-            add(hooks[i]);
+        this(true);
+        for (Hook hook : hooks) {
+            add(hook);
         }
         wireExtensibleHandlers();
     }

Modified: james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractHookableCmdHandler.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractHookableCmdHandler.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractHookableCmdHandler.java (original)
+++ james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractHookableCmdHandler.java Tue Jan 26 10:49:49 2016
@@ -84,28 +84,28 @@ public abstract class AbstractHookableCm
         List<Hook> hooks = getHooks();
         if (hooks != null) {
             int count = hooks.size();
-            for (int i = 0; i < count; i++) {
+            int i = 0;
+            while (i < count) {
                 Hook rawHook = hooks.get(i);
                 session.getLogger().debug("executing hook " + rawHook.getClass().getName());
                 long start = System.currentTimeMillis();
-                
+
                 HookResult hRes = callHook(rawHook, session, parameters);
                 long executionTime = System.currentTimeMillis() - start;
 
                 if (rHooks != null) {
-                    for (int i2 = 0; i2 < rHooks.size(); i2++) {
-                        Object rHook = rHooks.get(i2);
+                    for (HookResultHook rHook : rHooks) {
                         session.getLogger().debug("executing hook " + rHook);
-                        hRes = ((HookResultHook) rHook).onHookResult(session, hRes, executionTime, rawHook);
+                        hRes = rHook.onHookResult(session, hRes, executionTime, rawHook);
                     }
                 }
-                
+
                 // call the core cmd if we receive a ok return code of the hook so no other hooks are executed
                 if ((hRes.getResult() & HookReturnCode.OK) == HookReturnCode.OK) {
                     final Response response = doCoreCmd(session, command, parameters);
                     if ((hRes.getResult() & HookReturnCode.DISCONNECT) == HookReturnCode.DISCONNECT) {
                         return new Response() {
-                            
+
                             /*
                              * (non-Javadoc)
                              * @see org.apache.james.protocols.api.Response#isEndSession()
@@ -113,7 +113,7 @@ public abstract class AbstractHookableCm
                             public boolean isEndSession() {
                                 return true;
                             }
-                            
+
                             /*
                              * (non-Javadoc)
                              * @see org.apache.james.protocols.api.Response#getRetCode()
@@ -121,7 +121,7 @@ public abstract class AbstractHookableCm
                             public String getRetCode() {
                                 return response.getRetCode();
                             }
-                            
+
                             /*
                              * (non-Javadoc)
                              * @see org.apache.james.protocols.api.Response#getLines()
@@ -138,6 +138,7 @@ public abstract class AbstractHookableCm
                         return res;
                     }
                 }
+                i++;
             }
         }
         return null;

Modified: james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/DataLineMessageHookHandler.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/DataLineMessageHookHandler.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/DataLineMessageHookHandler.java (original)
+++ james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/DataLineMessageHookHandler.java Tue Jan 26 10:49:49 2016
@@ -129,9 +129,8 @@ public class DataLineMessageHookHandler
        
 
         if (mail != null && messageHandlers != null) {
-            int count = messageHandlers.size();
-            for (int i = 0; i < count; i++) {
-                MessageHook rawHandler = (MessageHook) messageHandlers.get(i);
+            for (Object messageHandler : messageHandlers) {
+                MessageHook rawHandler = (MessageHook) messageHandler;
                 session.getLogger().debug("executing message handler " + rawHandler);
 
                 long start = System.currentTimeMillis();
@@ -139,10 +138,8 @@ public class DataLineMessageHookHandler
                 long executionTime = System.currentTimeMillis() - start;
 
                 if (rHooks != null) {
-                    for (int i2 = 0; i2 < rHooks.size(); i2++) {
-                        Object rHook = rHooks.get(i2);
+                    for (Object rHook : rHooks) {
                         session.getLogger().debug("executing hook " + rHook);
-
                         hRes = ((HookResultHook) rHook).onHookResult(session, hRes, executionTime, rawHandler);
                     }
                 }

Modified: james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java (original)
+++ james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java Tue Jan 26 10:49:49 2016
@@ -23,7 +23,6 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -304,11 +303,10 @@ public class MailCmdHandler extends Abst
     public void wireExtensions(Class interfaceName, List extension) {
         if (MailParametersHook.class.equals(interfaceName)) {
             this.paramHooks = new HashMap<String, MailParametersHook>();
-            for (Iterator<MailParametersHook> i = extension.iterator(); i.hasNext(); ) {
-                MailParametersHook hook =  i.next();
+            for (MailParametersHook hook : (Iterable<MailParametersHook>) extension) {
                 String[] params = hook.getMailParamNames();
-                for (int k = 0; k < params.length; k++) {
-                    paramHooks.put(params[k], hook);
+                for (String param : params) {
+                    paramHooks.put(param, hook);
                 }
             }
         } else {

Modified: james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java (original)
+++ james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java Tue Jan 26 10:49:49 2016
@@ -378,34 +378,29 @@ public class AuthCmdHandler
         List<AuthHook> hooks = getHooks();
         
         if (hooks != null) {
-            int count = hooks.size();
-            for (int i = 0; i < count; i++) {
-                AuthHook rawHook = hooks.get(i);
+            for (AuthHook rawHook : hooks) {
                 session.getLogger().debug("executing  hook " + rawHook);
-                
 
                 long start = System.currentTimeMillis();
                 HookResult hRes = rawHook.doAuth(session, user, pass);
                 long executionTime = System.currentTimeMillis() - start;
 
                 if (rHooks != null) {
-                    for (int i2 = 0; i2 < rHooks.size(); i2++) {
-                        Object rHook = rHooks.get(i2);
+                    for (HookResultHook rHook : rHooks) {
                         session.getLogger().debug("executing  hook " + rHook);
-                    
-                        hRes = ((HookResultHook) rHook).onHookResult(session, hRes, executionTime, rawHook);
+                        hRes = rHook.onHookResult(session, hRes, executionTime, rawHook);
                     }
                 }
-                
+
                 res = calcDefaultSMTPResponse(hRes);
-                
+
                 if (res != null) {
                     if (SMTPRetCode.AUTH_FAILED.equals(res.getRetCode())) {
-                        session.getLogger().info("AUTH method "+authType+" failed");
+                        session.getLogger().info("AUTH method " + authType + " failed");
                     } else if (SMTPRetCode.AUTH_OK.equals(res.getRetCode())) {
                         if (session.getLogger().isDebugEnabled()) {
                             // TODO: Make this string a more useful debug message
-                            session.getLogger().debug("AUTH method "+authType+" succeeded");
+                            session.getLogger().debug("AUTH method " + authType + " succeeded");
                         }
                     }
                     return res;

Modified: james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java (original)
+++ james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java Tue Jan 26 10:49:49 2016
@@ -124,13 +124,11 @@ public class EhloCmdHandler extends Abst
      */
     private void processExtensions(SMTPSession session, SMTPResponse resp) {
         if (ehloExtensions != null) {
-            int count = ehloExtensions.size();
-            for (int i = 0; i < count; i++) {
-                List<String> lines = ((EhloExtension) ehloExtensions.get(i))
-                        .getImplementedEsmtpFeatures(session);
+            for (EhloExtension ehloExtension : ehloExtensions) {
+                List<String> lines = ehloExtension.getImplementedEsmtpFeatures(session);
                 if (lines != null) {
-                    for (int j = 0; j < lines.size(); j++) {
-                        resp.appendLine(lines.get(j));
+                    for (String line : lines) {
+                        resp.appendLine(line);
                     }
                 }
             }

Modified: james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandler.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandler.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandler.java (original)
+++ james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandler.java Tue Jan 26 10:49:49 2016
@@ -133,16 +133,16 @@ public class DNSRBLHandler implements Rc
 
             if (whitelist != null) {
                 String[] rblList = whitelist;
-                for (int i = 0 ; i < rblList.length ; i++) {
-                    if (resolve(reversedOctets + rblList[i])) {
+                for (String rbl : rblList) {
+                    if (resolve(reversedOctets + rbl)) {
                         if (session.getLogger().isInfoEnabled()) {
-                            session.getLogger().info("Connection from " + ipAddress + " whitelisted by " + rblList[i]);
+                            session.getLogger().info("Connection from " + ipAddress + " whitelisted by " + rbl);
                         }
-                    
+
                         return;
                     } else {
                         if (session.getLogger().isDebugEnabled()) {
-                            session.getLogger().debug("IpAddress " + session.getRemoteAddress().getAddress()  + " not listed on " + rblList[i]);
+                            session.getLogger().debug("IpAddress " + session.getRemoteAddress().getAddress() + " not listed on " + rbl);
                         }
                     }
                 }
@@ -150,34 +150,34 @@ public class DNSRBLHandler implements Rc
 
             if (blacklist != null) {
                 String[] rblList = blacklist;
-                for (int i = 0 ; i < rblList.length ; i++) {
-                    if (resolve(reversedOctets + rblList[i])) {
+                for (String rbl : rblList) {
+                    if (resolve(reversedOctets + rbl)) {
                         if (session.getLogger().isInfoEnabled()) {
-                            session.getLogger().info("Connection from " + ipAddress + " restricted by " + rblList[i] + " to SMTP AUTH/postmaster/abuse.");
+                            session.getLogger().info("Connection from " + ipAddress + " restricted by " + rbl + " to SMTP AUTH/postmaster/abuse.");
                         }
-                        
+
                         // we should try to retrieve details
                         if (getDetail) {
-                            Collection<String> txt = resolveTXTRecords(reversedOctets + rblList[i]);
-                            
+                            Collection<String> txt = resolveTXTRecords(reversedOctets + rbl);
+
                             // Check if we found a txt record
                             if (!txt.isEmpty()) {
                                 // Set the detail
                                 String blocklistedDetail = txt.iterator().next().toString();
-                                
+
                                 session.setAttachment(RBL_DETAIL_MAIL_ATTRIBUTE_NAME, blocklistedDetail, State.Connection);
                             }
                         }
-                        
+
                         session.setAttachment(RBL_BLOCKLISTED_MAIL_ATTRIBUTE_NAME, "true", State.Connection);
                         return;
                     } else {
                         // if it is unknown, it isn't blocked
                         if (session.getLogger().isDebugEnabled()) {
-                            session.getLogger().debug("unknown host exception thrown:" + rblList[i]);
+                            session.getLogger().debug("unknown host exception thrown:" + rbl);
                         }
                     }
-                   
+
                 }
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message