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 [1/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
Author: matthieu
Date: Tue Jan 26 10:49:49 2016
New Revision: 1726771

URL: http://svn.apache.org/viewvc?rev=1726771&view=rev
Log:
JAMES-1669 refactor for loop to foreach

Modified:
    james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/acl/UnionMailboxACLResolver.java
    james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/model/FetchGroupImpl.java
    james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/model/UpdatedFlags.java
    james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractStressTest.java
    james/project/trunk/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/mail/HBaseMessageMapper.java
    james/project/trunk/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/mail/HBaseMailboxMessageMapperTest.java
    james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/mail/JCRMessageMapper.java
    james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/mail/model/JCRMailboxMessage.java
    james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/JCRSubscriptionMapper.java
    james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/model/JCRSubscription.java
    james/project/trunk/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java
    james/project/trunk/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java
    james/project/trunk/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LuceneMessageSearchIndex.java
    james/project/trunk/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMessageMapper.java
    james/project/trunk/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMessageMapper.java
    james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java
    james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java
    james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
    james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
    james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/FlagsBuilder.java
    james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java
    james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java
    james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java
    james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SearchUtil.java
    james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java
    james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/comparator/CombinedComparator.java
    james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/FullByteContent.java
    james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/PartContentBuilderComplexMultipartTest.java
    james/project/trunk/mailet/api/src/test/java/org/apache/mailet/MailAddressTest.java
    james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/Runner.java
    james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java
    james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/protocol/ProtocolSession.java
    james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/script/AbstractProtocolTestFramework.java
    james/project/trunk/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java
    james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java
    james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java
    james/project/trunk/protocols/api/src/main/java/org/apache/james/protocols/api/handler/AbstractProtocolHandlerChain.java
    james/project/trunk/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java
    james/project/trunk/protocols/api/src/test/java/org/apache/james/protocols/api/AbstractProtocolTransportTest.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/api/display/CharsetUtil.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/SearchResponseEncoder.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/CopyProcessor.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MessageResultUtils.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimeBodyElement.java
    james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimePathImpl.java
    james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java
    james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java
    james/project/trunk/protocols/imap/src/test/java/org/apache/james/imap/main/AbstractTestOutputStreamImapResponseWriter.java
    james/project/trunk/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java
    james/project/trunk/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java
    james/project/trunk/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelUpstreamHandler.java
    james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/CapaCmdHandler.java
    james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/ListCmdHandler.java
    james/project/trunk/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/StatCmdHandler.java
    james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/MailAddress.java
    james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPProtocolHandlerChain.java
    james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractHookableCmdHandler.java
    james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/DataLineMessageHookHandler.java
    james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java
    james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java
    james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java
    james/project/trunk/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandler.java

Modified: james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/acl/UnionMailboxACLResolver.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/acl/UnionMailboxACLResolver.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/acl/UnionMailboxACLResolver.java (original)
+++ james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/acl/UnionMailboxACLResolver.java Tue Jan 26 10:49:49 2016
@@ -21,7 +21,6 @@
 package org.apache.james.mailbox.acl;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -251,8 +250,7 @@ public class UnionMailboxACLResolver imp
         boolean result = false;
         Map<MailboxACLEntryKey, MailboxACLRights> entries = resourceOwnerIsGroup ? groupGlobalACL.getEntries() : userGlobalACL.getEntries();
         if (entries != null) {
-            for (Iterator<Map.Entry<MailboxACLEntryKey, MailboxACLRights>> it = entries.entrySet().iterator(); it.hasNext();) {
-                final Entry<MailboxACLEntryKey, MailboxACLRights> entry = it.next();
+            for (Entry<MailboxACLEntryKey, MailboxACLRights> entry : entries.entrySet()) {
                 final MailboxACLEntryKey key = entry.getKey();
                 if (applies(key, queryKey, groupMembershipResolver, resourceOwner, resourceOwnerIsGroup) && entry.getValue().contains(right)) {
                     if (key.isNegative()) {
@@ -267,8 +265,7 @@ public class UnionMailboxACLResolver imp
         if (resourceACL != null) {
             entries = resourceACL.getEntries();
             if (entries != null) {
-                for (Iterator<Map.Entry<MailboxACLEntryKey, MailboxACLRights>> it = entries.entrySet().iterator(); it.hasNext();) {
-                    final Entry<MailboxACLEntryKey, MailboxACLRights> entry = it.next();
+                for (Entry<MailboxACLEntryKey, MailboxACLRights> entry : entries.entrySet()) {
                     final MailboxACLEntryKey key = entry.getKey();
                     if (applies(key, queryKey, groupMembershipResolver, resourceOwner, resourceOwnerIsGroup) && entry.getValue().contains(right)) {
                         if (key.isNegative()) {
@@ -425,8 +422,7 @@ public class UnionMailboxACLResolver imp
     private void resolveRights(MailboxACLEntryKey queryKey, GroupMembershipResolver groupMembershipResolver, final Map<MailboxACLEntryKey, MailboxACLRights> entries, String resourceOwner, boolean resourceOwnerIsGroup, MailboxACL.MailboxACLRights[] positiveNegativePair)
             throws UnsupportedRightException {
         if (entries != null) {
-            for (Iterator<Map.Entry<MailboxACLEntryKey, MailboxACLRights>> it = entries.entrySet().iterator(); it.hasNext();) {
-                final Entry<MailboxACLEntryKey, MailboxACLRights> entry = it.next();
+            for (Entry<MailboxACLEntryKey, MailboxACLRights> entry : entries.entrySet()) {
                 final MailboxACLEntryKey key = entry.getKey();
                 if (applies(key, queryKey, groupMembershipResolver, resourceOwner, resourceOwnerIsGroup)) {
                     if (key.isNegative()) {

Modified: james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/model/FetchGroupImpl.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/model/FetchGroupImpl.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/model/FetchGroupImpl.java (original)
+++ james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/model/FetchGroupImpl.java Tue Jan 26 10:49:49 2016
@@ -20,7 +20,6 @@
 package org.apache.james.mailbox.model;
 
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 import org.apache.james.mailbox.model.MessageResult.MimePath;
@@ -92,8 +91,7 @@ public class FetchGroupImpl implements M
             partContentDescriptors = new HashSet<PartContentDescriptor>();
         }
         PartContentDescriptorImpl currentDescriptor = null;
-        for (Iterator<PartContentDescriptor> it = partContentDescriptors.iterator(); it.hasNext();) {
-            PartContentDescriptor descriptor = (PartContentDescriptor) it.next();
+        for (PartContentDescriptor descriptor : partContentDescriptors) {
             if (path.equals(descriptor.path())) {
                 currentDescriptor = (PartContentDescriptorImpl) descriptor;
                 break;

Modified: james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/model/UpdatedFlags.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/model/UpdatedFlags.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/model/UpdatedFlags.java (original)
+++ james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/model/UpdatedFlags.java Tue Jan 26 10:49:49 2016
@@ -76,11 +76,9 @@ public class UpdatedFlags {
     
 
     private static void addModifiedUserFlags(Flags oldFlags, Flags newFlags, String[] userflags, Flags modifiedFlags) {
-        for (int i = 0; i < userflags.length; i++) {
-            String userFlag = userflags[i];
+        for (String userFlag : userflags) {
             if (isChanged(oldFlags, newFlags, userFlag)) {
                 modifiedFlags.add(userFlag);
-
             }
         }
     }

Modified: james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractStressTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractStressTest.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractStressTest.java (original)
+++ james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractStressTest.java Tue Jan 26 10:49:49 2016
@@ -121,12 +121,11 @@ public abstract class AbstractStressTest
 
         // check if the uids were higher on each append. See MAILBOX-131
         long last = 0;
-        for (int i = 0; i < uList.size(); i++) {
-            long l = uList.get(i);
-            if (l <= last) {
-                fail(l + "->" + last);
+        for (Long uid : uList) {
+            if (uid <= last) {
+                fail(uid + "->" + last);
             } else {
-                last = l;
+                last = uid;
             }
 
         }

Modified: james/project/trunk/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/mail/HBaseMessageMapper.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/mail/HBaseMessageMapper.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/mail/HBaseMessageMapper.java (original)
+++ james/project/trunk/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/mail/HBaseMessageMapper.java Tue Jan 26 10:49:49 2016
@@ -758,8 +758,7 @@ public class HBaseMessageMapper extends
 
     private Map<Long, MessageMetaData> createMetaData(List<MailboxMessage<HBaseId>> uids) {
         final Map<Long, MessageMetaData> data = new HashMap<Long, MessageMetaData>();
-        for (int i = 0; i < uids.size(); i++) {
-            MailboxMessage<HBaseId> m = uids.get(i);
+        for (MailboxMessage<HBaseId> m : uids) {
             data.put(m.getUid(), new SimpleMessageMetaData(m));
         }
         return data;

Modified: james/project/trunk/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/mail/HBaseMailboxMessageMapperTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/mail/HBaseMailboxMessageMapperTest.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/mail/HBaseMailboxMessageMapperTest.java (original)
+++ james/project/trunk/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/mail/HBaseMailboxMessageMapperTest.java Tue Jan 26 10:49:49 2016
@@ -18,29 +18,6 @@
  ****************************************************************/
 package org.apache.james.mailbox.hbase.mail;
 
-import static org.apache.james.mailbox.hbase.HBaseNames.MAILBOXES;
-import static org.apache.james.mailbox.hbase.HBaseNames.MAILBOXES_TABLE;
-import static org.apache.james.mailbox.hbase.HBaseNames.MAILBOX_CF;
-import static org.apache.james.mailbox.hbase.HBaseNames.MESSAGES;
-import static org.apache.james.mailbox.hbase.HBaseNames.MESSAGES_META_CF;
-import static org.apache.james.mailbox.hbase.HBaseNames.MESSAGES_TABLE;
-import static org.apache.james.mailbox.hbase.HBaseNames.MESSAGE_DATA_BODY_CF;
-import static org.apache.james.mailbox.hbase.HBaseNames.MESSAGE_DATA_HEADERS_CF;
-import static org.apache.james.mailbox.hbase.HBaseNames.SUBSCRIPTIONS;
-import static org.apache.james.mailbox.hbase.HBaseNames.SUBSCRIPTIONS_TABLE;
-import static org.apache.james.mailbox.hbase.HBaseNames.SUBSCRIPTION_CF;
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Random;
-
-import javax.mail.Flags;
-import javax.mail.internet.SharedInputStream;
-import javax.mail.util.SharedByteArrayInputStream;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.james.mailbox.MailboxSession;
@@ -58,6 +35,28 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.mail.Flags;
+import javax.mail.internet.SharedInputStream;
+import javax.mail.util.SharedByteArrayInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+
+import static org.apache.james.mailbox.hbase.HBaseNames.MAILBOXES;
+import static org.apache.james.mailbox.hbase.HBaseNames.MAILBOXES_TABLE;
+import static org.apache.james.mailbox.hbase.HBaseNames.MAILBOX_CF;
+import static org.apache.james.mailbox.hbase.HBaseNames.MESSAGES;
+import static org.apache.james.mailbox.hbase.HBaseNames.MESSAGES_META_CF;
+import static org.apache.james.mailbox.hbase.HBaseNames.MESSAGES_TABLE;
+import static org.apache.james.mailbox.hbase.HBaseNames.MESSAGE_DATA_BODY_CF;
+import static org.apache.james.mailbox.hbase.HBaseNames.MESSAGE_DATA_HEADERS_CF;
+import static org.apache.james.mailbox.hbase.HBaseNames.SUBSCRIPTIONS;
+import static org.apache.james.mailbox.hbase.HBaseNames.SUBSCRIPTIONS_TABLE;
+import static org.apache.james.mailbox.hbase.HBaseNames.SUBSCRIPTION_CF;
+import static org.junit.Assert.assertEquals;
+
 /**
  * Unit tests for HBaseMessageMapper.
  *
@@ -100,8 +99,8 @@ public class HBaseMailboxMessageMapperTe
         generateTestData();
         final MailboxSession session = new MockMailboxSession("ieugen");
         messageMapper = new HBaseMessageMapper(session, uidProvider, modSeqProvider, conf);
-        for (int i = 0; i < MESSAGE_NO.size(); i++) {
-            messageMapper.add(MBOXES.get(1), MESSAGE_NO.get(i));
+        for (MailboxMessage<HBaseId> message : MESSAGE_NO) {
+            messageMapper.add(MBOXES.get(1), message);
         }
     }
 

Modified: james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/mail/JCRMessageMapper.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/mail/JCRMessageMapper.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/mail/JCRMessageMapper.java (original)
+++ james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/mail/JCRMessageMapper.java Tue Jan 26 10:49:49 2016
@@ -409,8 +409,7 @@ public class JCRMessageMapper extends Ab
                 break;
             }
             Map<Long, MessageMetaData> uids = new HashMap<Long, MessageMetaData>();
-            for (int i = 0; i < results.size(); i++) {
-                MailboxMessage<JCRId> m = results.get(i);
+            for (MailboxMessage<JCRId> m : results) {
                 long uid = m.getUid();
                 uids.put(uid, new SimpleMessageMetaData(m));
                 delete(mailbox, m);

Modified: james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/mail/model/JCRMailboxMessage.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/mail/model/JCRMailboxMessage.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/mail/model/JCRMailboxMessage.java (original)
+++ james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/mail/model/JCRMailboxMessage.java Tue Jan 26 10:49:49 2016
@@ -298,10 +298,9 @@ public class JCRMailboxMessage implement
 
 
             List<Property> currentProperties = getProperties();
-            List<Property> newProperites = new ArrayList<Property>();
-            for (int i = 0; i < currentProperties.size(); i++) {
-                Property prop = currentProperties.get(i);
-                newProperites.add(new JCRProperty(prop, logger));
+            List<Property> newProperties = new ArrayList<Property>();
+            for (Property prop : currentProperties) {
+                newProperties.add(new JCRProperty(prop, logger));
             }
             // remove old properties, we will add a bunch of new ones
             NodeIterator iterator = node.getNodes("messageProperty");
@@ -310,8 +309,8 @@ public class JCRMailboxMessage implement
             }
 
             // store new properties
-            for (int i = 0; i < newProperites.size(); i++) {
-                JCRProperty prop = (JCRProperty) newProperites.get(i);
+            for (Property newProperty : newProperties) {
+                JCRProperty prop = (JCRProperty) newProperty;
                 Node propNode = node.addNode("messageProperty", "nt:unstructured");
                 propNode.addMixin(PROPERTY_NODE_TYPE);
                 prop.merge(propNode);

Modified: james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/JCRSubscriptionMapper.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/JCRSubscriptionMapper.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/JCRSubscriptionMapper.java (original)
+++ james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/JCRSubscriptionMapper.java Tue Jan 26 10:49:49 2016
@@ -72,8 +72,8 @@ public class JCRSubscriptionMapper exten
                 Property prop = node.getProperty(JCRSubscription.MAILBOXES_PROPERTY);
                 Value[] values = prop.getValues();
                 List<String> newValues = new ArrayList<String>();
-                for (int i = 0; i < values.length; i++) {
-                    String m = values[i].getString();
+                for (Value value : values) {
+                    String m = value.getString();
                     if (m.equals(sub.getMailbox()) == false) {
                         newValues.add(m);
                     }
@@ -139,8 +139,8 @@ public class JCRSubscriptionMapper exten
                 Node node = nodeIt.nextNode();
                 if (node.hasProperty(JCRSubscription.MAILBOXES_PROPERTY)) {
                     Value[] values = node.getProperty(JCRSubscription.MAILBOXES_PROPERTY).getValues();
-                    for (int i = 0; i < values.length; i++) {
-                        subList.add(new JCRSubscription(node, values[i].getString(), getLogger()));
+                    for (Value value : values) {
+                        subList.add(new JCRSubscription(node, value.getString(), getLogger()));
                     }
                 }
             }

Modified: james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/model/JCRSubscription.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/model/JCRSubscription.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/model/JCRSubscription.java (original)
+++ james/project/trunk/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/model/JCRSubscription.java Tue Jan 26 10:49:49 2016
@@ -112,8 +112,8 @@ public class JCRSubscription implements
         if (node.hasProperty(MAILBOXES_PROPERTY)) {
             Value[] mailboxes = node.getProperty(MAILBOXES_PROPERTY).getValues();
             List<String>newMailboxes = new ArrayList<String>();
-            for (int i = 0; i< mailboxes.length; i++) {
-                String m = mailboxes[i].getString();
+            for (Value mailbox : mailboxes) {
+                String m = mailbox.getString();
                 newMailboxes.add(m);
             }
             if (newMailboxes.contains(getMailbox()) == false) {

Modified: james/project/trunk/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java (original)
+++ james/project/trunk/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java Tue Jan 26 10:49:49 2016
@@ -358,8 +358,7 @@ public class JPAMessageMapper extends Ab
 
     private Map<Long, MessageMetaData> createMetaData(List<MailboxMessage<JPAId>> uids) {
         final Map<Long, MessageMetaData> data = new HashMap<Long, MessageMetaData>();
-        for (int i = 0; i < uids.size(); i++) {
-            MailboxMessage<JPAId> m = uids.get(i);
+        for (MailboxMessage<JPAId> m : uids) {
             data.put(m.getUid(), new SimpleMessageMetaData(m));
         }
         return data;

Modified: james/project/trunk/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java (original)
+++ james/project/trunk/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java Tue Jan 26 10:49:49 2016
@@ -507,8 +507,8 @@ public abstract class AbstractJPAMailbox
         */
         String[] userflags =  flags.getUserFlags();
         userFlags.clear();
-        for (int i = 0 ; i< userflags.length; i++) {
-            userFlags.add(new JPAUserFlag(userflags[i]));
+        for (String userflag : userflags) {
+            userFlags.add(new JPAUserFlag(userflag));
         }
     }
 

Modified: james/project/trunk/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LuceneMessageSearchIndex.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LuceneMessageSearchIndex.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LuceneMessageSearchIndex.java (original)
+++ james/project/trunk/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LuceneMessageSearchIndex.java Tue Jan 26 10:49:49 2016
@@ -419,15 +419,15 @@ public class LuceneMessageSearchIndex<Id
             // Not return flags documents
             query.add(new PrefixQuery(new Term(FLAGS_FIELD, "")), BooleanClause.Occur.MUST_NOT);
             List<Criterion> crits = searchQuery.getCriterias();
-            for (int i = 0; i < crits.size(); i++) {
-                query.add(createQuery(crits.get(i), mailbox, searchQuery.getRecentMessageUids()), BooleanClause.Occur.MUST);
+            for (Criterion crit : crits) {
+                query.add(createQuery(crit, mailbox, searchQuery.getRecentMessageUids()), BooleanClause.Occur.MUST);
             }
 
             // query for all the documents sorted as specified in the SearchQuery
             TopDocs docs = searcher.search(query, null, maxQueryResults, createSort(searchQuery.getSorts()));
             ScoreDoc[] sDocs = docs.scoreDocs;
-            for (int i = 0; i < sDocs.length; i++) {
-                long uid = Long.valueOf(searcher.doc(sDocs[i].doc).get(UID_FIELD));
+            for (ScoreDoc sDoc : sDocs) {
+                long uid = Long.valueOf(searcher.doc(sDoc.doc).get(UID_FIELD));
                 uids.add(uid);
             }
         } catch (IOException e) {
@@ -848,8 +848,7 @@ public class LuceneMessageSearchIndex<Id
             return NumericRangeQuery.newLongRange(UID_FIELD, range.getLowValue(), range.getHighValue(), true, true);
         } else {
             BooleanQuery rangesQuery = new BooleanQuery();
-            for (int i = 0; i < ranges.length; i++) {
-                NumericRange range = ranges[i];
+            for (NumericRange range : ranges) {
                 rangesQuery.add(NumericRangeQuery.newLongRange(UID_FIELD, range.getLowValue(), range.getHighValue(), true, true), BooleanClause.Occur.SHOULD);
             }        
             return rangesQuery;
@@ -911,8 +910,8 @@ public class LuceneMessageSearchIndex<Id
             // query for all the documents sorted by uid
             TopDocs docs = searcher.search(query, null, maxQueryResults, new Sort(UID_SORT));
             ScoreDoc[] sDocs = docs.scoreDocs;
-            for (int i = 0; i < sDocs.length; i++) {
-                long uid = Long.valueOf(searcher.doc(sDocs[i].doc).get(UID_FIELD));
+            for (ScoreDoc sDoc : sDocs) {
+                long uid = Long.valueOf(searcher.doc(sDoc.doc).get(UID_FIELD));
                 uids.add(uid);
             }
             
@@ -948,91 +947,90 @@ public class LuceneMessageSearchIndex<Id
     private Sort createSort(List<SearchQuery.Sort> sorts) {
         Sort sort = new Sort();
         List<SortField> fields = new ArrayList<SortField>();
-        
-        for (int i = 0; i < sorts.size(); i++) {
-            SearchQuery.Sort s = sorts.get(i);
+
+        for (SearchQuery.Sort s : sorts) {
             boolean reverse = s.isReverse();
             SortField sf = null;
-            
+
             switch (s.getSortClause()) {
-            case Arrival:
-                if (reverse) {
-                    sf = ARRIVAL_MAILBOX_SORT_REVERSE;
-                } else {
-                    sf = ARRIVAL_MAILBOX_SORT;
-                }
-                break;
-            case SentDate:
-                if (reverse) {
-                    sf = SENT_DATE_SORT_REVERSE;
-                } else {
-                    sf = SENT_DATE_SORT;
-                }
-                break;
-            case MailboxCc:
-                if (reverse) {
-                    sf = FIRST_CC_MAILBOX_SORT_REVERSE;
-                } else {
-                    sf = FIRST_CC_MAILBOX_SORT;
-                }
-                break;
-            case MailboxFrom:
-                if (reverse) {
-                    sf = FIRST_FROM_MAILBOX_SORT_REVERSE;
-                } else {
-                    sf = FIRST_FROM_MAILBOX_SORT;
-                }
-                break;
-            case Size:
-                if (reverse) {
-                    sf = SIZE_SORT_REVERSE;
-                } else {
-                    sf = SIZE_SORT;
-                }
-                break;
-            case BaseSubject:
-                if (reverse) {
-                    sf = BASE_SUBJECT_SORT_REVERSE;
-                } else {
-                    sf = BASE_SUBJECT_SORT;
-                }
-                break;
-            case MailboxTo:
-                if (reverse) {
-                    sf = FIRST_TO_MAILBOX_SORT_REVERSE;
-                } else {
-                    sf = FIRST_TO_MAILBOX_SORT;
-                }
-                break;
-                
-            case Uid:
-                if (reverse) {
-                    sf = UID_SORT_REVERSE;
-                } else {
-                    sf = UID_SORT;
-                }
-                break;
-            case DisplayFrom:
-                if (reverse) {
-                    sf = FIRST_FROM_MAILBOX_DISPLAY_SORT_REVERSE;
-                } else {
-                    sf = FIRST_FROM_MAILBOX_DISPLAY_SORT;
-                }
-                break;
-            case DisplayTo:
-                if (reverse) {
-                    sf = FIRST_TO_MAILBOX_DISPLAY_SORT_REVERSE;
-                } else {
-                    sf = FIRST_TO_MAILBOX_DISPLAY_SORT;
-                }
-                break;   
-            default:
-                break;
+                case Arrival:
+                    if (reverse) {
+                        sf = ARRIVAL_MAILBOX_SORT_REVERSE;
+                    } else {
+                        sf = ARRIVAL_MAILBOX_SORT;
+                    }
+                    break;
+                case SentDate:
+                    if (reverse) {
+                        sf = SENT_DATE_SORT_REVERSE;
+                    } else {
+                        sf = SENT_DATE_SORT;
+                    }
+                    break;
+                case MailboxCc:
+                    if (reverse) {
+                        sf = FIRST_CC_MAILBOX_SORT_REVERSE;
+                    } else {
+                        sf = FIRST_CC_MAILBOX_SORT;
+                    }
+                    break;
+                case MailboxFrom:
+                    if (reverse) {
+                        sf = FIRST_FROM_MAILBOX_SORT_REVERSE;
+                    } else {
+                        sf = FIRST_FROM_MAILBOX_SORT;
+                    }
+                    break;
+                case Size:
+                    if (reverse) {
+                        sf = SIZE_SORT_REVERSE;
+                    } else {
+                        sf = SIZE_SORT;
+                    }
+                    break;
+                case BaseSubject:
+                    if (reverse) {
+                        sf = BASE_SUBJECT_SORT_REVERSE;
+                    } else {
+                        sf = BASE_SUBJECT_SORT;
+                    }
+                    break;
+                case MailboxTo:
+                    if (reverse) {
+                        sf = FIRST_TO_MAILBOX_SORT_REVERSE;
+                    } else {
+                        sf = FIRST_TO_MAILBOX_SORT;
+                    }
+                    break;
+
+                case Uid:
+                    if (reverse) {
+                        sf = UID_SORT_REVERSE;
+                    } else {
+                        sf = UID_SORT;
+                    }
+                    break;
+                case DisplayFrom:
+                    if (reverse) {
+                        sf = FIRST_FROM_MAILBOX_DISPLAY_SORT_REVERSE;
+                    } else {
+                        sf = FIRST_FROM_MAILBOX_DISPLAY_SORT;
+                    }
+                    break;
+                case DisplayTo:
+                    if (reverse) {
+                        sf = FIRST_TO_MAILBOX_DISPLAY_SORT_REVERSE;
+                    } else {
+                        sf = FIRST_TO_MAILBOX_DISPLAY_SORT;
+                    }
+                    break;
+                default:
+                    break;
             }
             if (sf != null) {
 
                 fields.add(sf);
-                
+
                 // Add the uid sort as tie-breaker
                 if (sf == SENT_DATE_SORT) {
                     fields.add(UID_SORT);
@@ -1121,19 +1119,19 @@ public class LuceneMessageSearchIndex<Id
         BooleanQuery conQuery = new BooleanQuery();
         switch (crit.getType()) {
         case AND:
-            for (int i = 0; i < crits.size(); i++) {
-                conQuery.add(createQuery(crits.get(i), mailbox, recentUids), BooleanClause.Occur.MUST);
+            for (Criterion criterion : crits) {
+                conQuery.add(createQuery(criterion, mailbox, recentUids), BooleanClause.Occur.MUST);
             }
             return conQuery;
         case OR:
-            for (int i = 0; i < crits.size(); i++) {
-                conQuery.add(createQuery(crits.get(i), mailbox, recentUids), BooleanClause.Occur.SHOULD);
+            for (Criterion criterion : crits) {
+                conQuery.add(createQuery(criterion, mailbox, recentUids), BooleanClause.Occur.SHOULD);
             }
             return conQuery;
         case NOR:
             BooleanQuery nor = new BooleanQuery();
-            for (int i = 0; i < crits.size(); i++) {
-                conQuery.add(createQuery(crits.get(i), mailbox, recentUids), BooleanClause.Occur.SHOULD);
+            for (Criterion criterion : crits) {
+                conQuery.add(createQuery(criterion, mailbox, recentUids), BooleanClause.Occur.SHOULD);
             }
             nor.add(new TermQuery(new Term(MAILBOX_ID_FIELD, mailbox.getMailboxId().serialize())), BooleanClause.Occur.MUST);
 
@@ -1219,15 +1217,15 @@ public class LuceneMessageSearchIndex<Id
 
             TopDocs docs = searcher.search(query, 100000);
             ScoreDoc[] sDocs = docs.scoreDocs;
-            for (int i = 0; i < sDocs.length; i++) {
-                Document doc = searcher.doc(sDocs[i].doc);
-                
+            for (ScoreDoc sDoc : sDocs) {
+                Document doc = searcher.doc(sDoc.doc);
+
                 if (doc.getFieldable(FLAGS_FIELD) == null) {
                     doc.removeFields(FLAGS_FIELD);
                     indexFlags(doc, f);
 
                     writer.updateDocument(new Term(ID_FIELD, doc.get(ID_FIELD)), doc);
-            
+
                 }
             }
         } catch (IOException e) {
@@ -1268,14 +1266,14 @@ public class LuceneMessageSearchIndex<Id
     private void indexFlags(Document doc, Flags f) {
         List<String> fString = new ArrayList<String>();
         Flag[] flags = f.getSystemFlags();
-        for (int a = 0; a < flags.length; a++) {
-            fString.add(toString(flags[a]));
-            doc.add(new Field(FLAGS_FIELD, toString(flags[a]),Store.NO, Index.NOT_ANALYZED));
+        for (Flag flag : flags) {
+            fString.add(toString(flag));
+            doc.add(new Field(FLAGS_FIELD, toString(flag), Store.NO, Index.NOT_ANALYZED));
         }
         
         String[] userFlags = f.getUserFlags();
-        for (int a = 0; a < userFlags.length; a++) {
-            doc.add(new Field(FLAGS_FIELD, userFlags[a],Store.NO, Index.NOT_ANALYZED));
+        for (String userFlag : userFlags) {
+            doc.add(new Field(FLAGS_FIELD, userFlag, Store.NO, Index.NOT_ANALYZED));
         }
         
         // if no flags are there we just use a empty field

Modified: james/project/trunk/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMessageMapper.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMessageMapper.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMessageMapper.java (original)
+++ james/project/trunk/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMessageMapper.java Tue Jan 26 10:49:49 2016
@@ -252,8 +252,7 @@ public class MaildirMessageMapper extend
             break;
         }
         Map<Long, MessageMetaData> uids = new HashMap<Long, MessageMetaData>();
-        for (int i = 0; i < results.size(); i++) {
-            MailboxMessage<MaildirId> m = results.get(i);
+        for (MailboxMessage<MaildirId> m : results) {
             long uid = m.getUid();
             uids.put(uid, new SimpleMessageMetaData(m));
             delete(mailbox, m);

Modified: james/project/trunk/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMessageMapper.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMessageMapper.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMessageMapper.java (original)
+++ james/project/trunk/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMessageMapper.java Tue Jan 26 10:49:49 2016
@@ -161,8 +161,7 @@ public class InMemoryMessageMapper exten
     public Long findFirstUnseenMessageUid(Mailbox<InMemoryId> mailbox) throws MailboxException {
         List<MailboxMessage<InMemoryId>> memberships = new ArrayList<MailboxMessage<InMemoryId>>(getMembershipByUidForMailbox(mailbox).values());
         Collections.sort(memberships);
-        for (int i = 0; i < memberships.size(); i++) {
-            MailboxMessage<InMemoryId> m = memberships.get(i);
+        for (MailboxMessage<InMemoryId> m : memberships) {
             if (m.isSeen() == false) {
                 return m.getUid();
             }

Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java Tue Jan 26 10:49:49 2016
@@ -338,8 +338,7 @@ public class MimeDescriptorImpl implemen
     @Override
     public long size() throws MailboxException {
         long result = 0;
-        for (final Iterator<MessageResult.Header> it = headers.iterator(); it.hasNext();) {
-            final MessageResult.Header header = it.next();
+        for (final MessageResult.Header header : headers) {
             if (header != null) {
                 result += header.size();
                 result += 2;

Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java Tue Jan 26 10:49:49 2016
@@ -182,8 +182,7 @@ public class ResultUtils {
         PartContentBuilder result = new PartContentBuilder();
         result.parse(stream);
         try {
-            for (int i = 0; i < path.length; i++) {
-                final int next = path[i];
+            for (int next : path) {
                 result.to(next);
             }
         } catch (PartContentBuilder.PartNotFoundException e) {

Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java Tue Jan 26 10:49:49 2016
@@ -629,8 +629,7 @@ public class StoreMailboxManager<Id exte
     public List<MailboxPath> list(MailboxSession session) throws MailboxException {
         List<MailboxPath> mList = new ArrayList<MailboxPath>();
         List<Mailbox<Id>> mailboxes = mailboxSessionMapperFactory.getMailboxMapper(session).list();
-        for (int i = 0; i < mailboxes.size(); i++) {
-            Mailbox<Id> m = mailboxes.get(i);
+        for (Mailbox<Id> m : mailboxes) {
             mList.add(new MailboxPath(m.getNamespace(), m.getUser(), m.getName()));
         }
         return Collections.unmodifiableList(mList);

Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java Tue Jan 26 10:49:49 2016
@@ -502,9 +502,7 @@ public class StoreMessageManager<Id exte
         Flags permFlags = getPermanentFlags(session);
 
         Flag[] systemFlags = flags.getSystemFlags();
-        for (int i = 0; i < systemFlags.length; i++) {
-            Flag f = systemFlags[i];
-
+        for (Flag f : systemFlags) {
             if (f != Flag.RECENT && permFlags.contains(f) == false) {
                 flags.remove(f);
             }
@@ -513,8 +511,7 @@ public class StoreMessageManager<Id exte
         // all user flags are allowed
         if (permFlags.contains(Flags.Flag.USER) == false) {
             String[] uFlags = flags.getUserFlags();
-            for (int i = 0; i < uFlags.length; i++) {
-                String uFlag = uFlags[i];
+            for (String uFlag : uFlags) {
                 if (permFlags.contains(uFlag) == false) {
                     flags.remove(uFlag);
                 }

Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/FlagsBuilder.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/FlagsBuilder.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/FlagsBuilder.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/FlagsBuilder.java Tue Jan 26 10:49:49 2016
@@ -44,8 +44,8 @@ public class FlagsBuilder {
             flags.add(Flags.Flag.SEEN);
         }
         if (userFlags != null && userFlags.length > 0) {
-            for (int i = 0; i < userFlags.length; i++) {
-                flags.add(userFlags[i]);
+            for (String userFlag : userFlags) {
+                flags.add(userFlag);
             }
         }
         return flags;

Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java Tue Jan 26 10:49:49 2016
@@ -173,8 +173,7 @@ public class PropertyBuilder {
      */
     public SortedMap<String,String> getProperties(final String namespace) {
         final SortedMap<String, String> parameters = new TreeMap<String, String>();
-        for (Iterator<SimpleProperty> it= properties.iterator();it.hasNext();) {
-            final SimpleProperty property = it.next();
+        for (final SimpleProperty property : properties) {
             if (property.isInSpace(namespace)) {
                 parameters.put(property.getLocalName(), property.getValue());
             }

Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java Tue Jan 26 10:49:49 2016
@@ -99,8 +99,7 @@ public abstract class ListeningMessageSe
                     final Mailbox<Id> mailbox = expunged.getMailbox();
                     List<Long> uids = expunged.getUids();
                     List<MessageRange> ranges = MessageRange.toRanges(uids);
-                    for (int i = 0; i < ranges.size(); i++) {
-                        MessageRange range = ranges.get(i);
+                    for (MessageRange range : ranges) {
                         try {
                             delete(session, mailbox, range);
                         } catch (MailboxException e) {

Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java Tue Jan 26 10:49:49 2016
@@ -124,8 +124,7 @@ public class MessageSearches implements
         final Collection<Long> recentMessageUids = query.getRecentMessageUids();
         boolean result = true;
         if (criteria != null) {
-            for (Iterator<SearchQuery.Criterion> it = criteria.iterator(); it.hasNext();) {
-                final SearchQuery.Criterion criterion = it.next();
+            for (final SearchQuery.Criterion criterion : criteria) {
                 if (!isMatch(criterion, message, recentMessageUids, log)) {
                     result = false;
                     break;
@@ -242,8 +241,7 @@ public class MessageSearches implements
     private boolean and(final List<SearchQuery.Criterion> criteria, final MailboxMessage<?> message,
             final Collection<Long> recentMessageUids, Logger log) throws MailboxException {
         boolean result = true;
-        for (Iterator<SearchQuery.Criterion> it = criteria.iterator(); it.hasNext();) {
-            final SearchQuery.Criterion criterion = it.next();
+        for (final SearchQuery.Criterion criterion : criteria) {
             final boolean matches = isMatch(criterion, message, recentMessageUids, log);
             if (!matches) {
                 result = false;
@@ -256,8 +254,7 @@ public class MessageSearches implements
     private boolean or(final List<SearchQuery.Criterion> criteria, final MailboxMessage<?> message,
             final Collection<Long> recentMessageUids, Logger log) throws MailboxException {
         boolean result = false;
-        for (Iterator<SearchQuery.Criterion> it = criteria.iterator(); it.hasNext();) {
-            final SearchQuery.Criterion criterion = it.next();
+        for (final SearchQuery.Criterion criterion : criteria) {
             final boolean matches = isMatch(criterion, message, recentMessageUids, log);
             if (matches) {
                 result = true;
@@ -270,8 +267,7 @@ public class MessageSearches implements
     private boolean nor(final List<SearchQuery.Criterion> criteria, final MailboxMessage<?> message,
             final Collection<Long> recentMessageUids, Logger log) throws MailboxException {
         boolean result = true;
-        for (Iterator<SearchQuery.Criterion> it = criteria.iterator(); it.hasNext();) {
-            final SearchQuery.Criterion criterion = it.next();
+        for (final SearchQuery.Criterion criterion : criteria) {
             final boolean matches = isMatch(criterion, message, recentMessageUids, log);
             if (matches) {
                 result = false;
@@ -318,10 +314,8 @@ public class MessageSearches implements
         final SearchQuery.InOperator operator = criterion.getOperator();
         final NumericRange[] ranges = operator.getRange();
         final long uid = message.getUid();
-        final int length = ranges.length;
         boolean result = false;
-        for (int i = 0; i < length; i++) {
-            final NumericRange numericRange = ranges[i];
+        for (final NumericRange numericRange : ranges) {
             if (numericRange.isIn(uid)) {
                 result = true;
                 break;
@@ -368,18 +362,17 @@ public class MessageSearches implements
             if (headerName.equalsIgnoreCase(name)) {
                 final String value = header.getValue();
                 AddressList aList = LenientAddressParser.DEFAULT.parseAddressList(value);
-                for (int i = 0; i < aList.size(); i++) {
-                    Address address = aList.get(i);
+                for ( Address address : aList) {
                     if (address instanceof Mailbox) {
                         if (AddressFormatter.DEFAULT.encode((Mailbox) address).toUpperCase(Locale.ENGLISH)
-                                .contains(text)) {
+                            .contains(text)) {
                             return true;
                         }
                     } else if (address instanceof Group) {
                         MailboxList mList = ((Group) address).getMailboxes();
-                        for (int a = 0; a < mList.size(); a++) {
-                            if (AddressFormatter.DEFAULT.encode(mList.get(a)).toUpperCase(Locale.ENGLISH)
-                                    .contains(text)) {
+                        for (Mailbox mailbox : mList) {
+                            if (AddressFormatter.DEFAULT.encode(mailbox).toUpperCase(Locale.ENGLISH)
+                                .contains(text)) {
                                 return true;
                             }
                         }

Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SearchUtil.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SearchUtil.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SearchUtil.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SearchUtil.java Tue Jan 26 10:49:49 2016
@@ -150,8 +150,7 @@ public class SearchUtil {
      */
     public static String getMailboxAddress(String headerValue) {
         AddressList aList = LenientAddressParser.DEFAULT.parseAddressList(headerValue);
-        for (int i = 0; i < aList.size(); i++) {
-            Address address = aList.get(i);
+        for (Address address : aList) {
             if (address instanceof Mailbox) {
                 Mailbox m = (Mailbox) address;
                 String mailboxName = m.getLocalPart();
@@ -161,7 +160,7 @@ public class SearchUtil {
                 return mailboxName;
             } else if (address instanceof Group) {
                 MailboxList mList = ((Group) address).getMailboxes();
-                for (int a = 0; a < mList.size();) {
+                for (int a = 0; a < mList.size(); ) {
                     String mailboxName = mList.get(a).getLocalPart();
                     if (mailboxName == null) {
                         mailboxName = "";

Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java Tue Jan 26 10:49:49 2016
@@ -90,11 +90,10 @@ public class SimpleMessageSearchIndex<Id
             // if there is a conjugated uid range criterion in the query tree we can optimize by
             // only fetching this uid range
             NumericRange[] ranges = uidCrit.getOperator().getRange();
-            for (int i = 0; i < ranges.length; i++) {
-                NumericRange r = ranges[i];
+            for (NumericRange r : ranges) {
                 Iterator<MailboxMessage<Id>> it = mapper.findInMailbox(mailbox, MessageRange.range(r.getLowValue(), r.getHighValue()), FetchType.Metadata, -1);
-                while(it.hasNext()) {
-                	hitSet.add(it.next());
+                while (it.hasNext()) {
+                    hitSet.add(it.next());
                 }
             }
         } else {

Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/comparator/CombinedComparator.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/comparator/CombinedComparator.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/comparator/CombinedComparator.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/comparator/CombinedComparator.java Tue Jan 26 10:49:49 2016
@@ -42,8 +42,8 @@ public class CombinedComparator implemen
     @Override
     public int compare(MailboxMessage<?> o1, MailboxMessage<?> o2) {
         int i = 0;
-        for (int a = 0; a < comparators.length; a++) {
-            i = comparators[a].compare(o1, o2);
+        for (Comparator<MailboxMessage<?>> comparator : comparators) {
+            i = comparator.compare(o1, o2);
             if (i != 0) {
                 break;
             }
@@ -54,43 +54,42 @@ public class CombinedComparator implemen
     @SuppressWarnings("unchecked")
     public static Comparator<MailboxMessage<?>> create(List<Sort> sorts) {
         List<Comparator<?>> comps = new ArrayList<Comparator<?>>();
-        for (int i = 0; i < sorts.size(); i++) {
-            Sort sort = sorts.get(i);
+        for (Sort sort : sorts) {
             boolean reverse = sort.isReverse();
             Comparator<MailboxMessage<?>> comparator = null;
-            
+
             switch (sort.getSortClause()) {
-            case Arrival:
-                comparator = InternalDateComparator.internalDate(reverse);
-                break;
-            case MailboxCc:
-                comparator = HeaderMailboxComparator.cc(reverse);
-                break;
-            case MailboxFrom:
-                comparator = HeaderMailboxComparator.from(reverse);
-                break;
-            case Size:
-                comparator = SizeComparator.size(reverse);
-                break;
-            case BaseSubject:
-                comparator = BaseSubjectComparator.baseSubject(reverse);
-                break;
-            case MailboxTo:
-                comparator = HeaderMailboxComparator.to(reverse);
-                break;
-            case Uid:
-                comparator = UidComparator.uid(reverse);
-                break;
-            case SentDate: 
-                comparator = SentDateComparator.sentDate(reverse);
-            case DisplayFrom: 
-                comparator = HeaderDisplayComparator.from(reverse);
-                break;
-            case DisplayTo:
-                comparator = HeaderDisplayComparator.to(reverse);
-                break;
-            default:
-                break;
+                case Arrival:
+                    comparator = InternalDateComparator.internalDate(reverse);
+                    break;
+                case MailboxCc:
+                    comparator = HeaderMailboxComparator.cc(reverse);
+                    break;
+                case MailboxFrom:
+                    comparator = HeaderMailboxComparator.from(reverse);
+                    break;
+                case Size:
+                    comparator = SizeComparator.size(reverse);
+                    break;
+                case BaseSubject:
+                    comparator = BaseSubjectComparator.baseSubject(reverse);
+                    break;
+                case MailboxTo:
+                    comparator = HeaderMailboxComparator.to(reverse);
+                    break;
+                case Uid:
+                    comparator = UidComparator.uid(reverse);
+                    break;
+                case SentDate:
+                    comparator = SentDateComparator.sentDate(reverse);
+                case DisplayFrom:
+                    comparator = HeaderDisplayComparator.from(reverse);
+                    break;
+                case DisplayTo:
+                    comparator = HeaderDisplayComparator.to(reverse);
+                    break;
+                default:
+                    break;
             }
             if (comparator != null) {
                 comps.add(comparator);

Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/FullByteContent.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/FullByteContent.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/FullByteContent.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/FullByteContent.java Tue Jan 26 10:49:49 2016
@@ -18,19 +18,18 @@
  ****************************************************************/
 package org.apache.james.mailbox.store.streaming;
 
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.Content;
+import org.apache.james.mailbox.model.MessageResult;
+import org.apache.james.mailbox.model.MessageResult.Header;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.SequenceInputStream;
-import java.util.Iterator;
 import java.util.List;
 
-import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.mailbox.model.Content;
-import org.apache.james.mailbox.model.MessageResult;
-import org.apache.james.mailbox.model.MessageResult.Header;
-
 /**
  * Abstract base class for {@link Content} implementations which hold the headers and 
  * the body a email
@@ -52,8 +51,7 @@ public class FullByteContent implements
     protected long caculateSize() throws MailboxException{
         long result = body.length;
         result += 2;
-        for (final Iterator<MessageResult.Header> it = headers.iterator(); it.hasNext();) {
-            final MessageResult.Header header = it.next();
+        for (final Header header : headers) {
             if (header != null) {
                 result += header.size();
                 result += 2;
@@ -65,8 +63,7 @@ public class FullByteContent implements
     @Override
     public InputStream getInputStream() throws IOException {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
-        for (final Iterator<MessageResult.Header> it = headers.iterator(); it.hasNext();) {
-            final MessageResult.Header header = it.next();
+        for (Header header : headers) {
             if (header != null) {
                 try {
                     out.write((header.getName() + ": " + header.getValue() + "\r\n").getBytes("US-ASCII"));

Modified: james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/PartContentBuilderComplexMultipartTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/PartContentBuilderComplexMultipartTest.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/PartContentBuilderComplexMultipartTest.java (original)
+++ james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/PartContentBuilderComplexMultipartTest.java Tue Jan 26 10:49:49 2016
@@ -218,8 +218,8 @@ public class PartContentBuilderComplexMu
         InputStream in = new ByteArrayInputStream(Charset.forName("us-ascii")
                 .encode(MULTIPART_MIXED).array());
         builder.parse(in);
-        for (int i = 0; i < path.length; i++) {
-            builder.to(path[i]);
+        for (int aPath : path) {
+            builder.to(aPath);
         }
     }
 }

Modified: james/project/trunk/mailet/api/src/test/java/org/apache/mailet/MailAddressTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailet/api/src/test/java/org/apache/mailet/MailAddressTest.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mailet/api/src/test/java/org/apache/mailet/MailAddressTest.java (original)
+++ james/project/trunk/mailet/api/src/test/java/org/apache/mailet/MailAddressTest.java Tue Jan 26 10:49:49 2016
@@ -100,18 +100,18 @@ public class MailAddressTest {
         MailAddress a = new MailAddress(GOOD_ADDRESS);
         assertTrue(GOOD_ADDRESS.equals(a.toString()));
 
-        for (int i = 0; i < GOOD_ADDRESSES.length; i++) {
+        for (String goodAddress : GOOD_ADDRESSES) {
             try {
-                a = new MailAddress(GOOD_ADDRESSES[i]);
+                a = new MailAddress(goodAddress);
             } catch (AddressException e) {
                 fail(e.getMessage());
             }
         }
 
-        for (int i = 0; i < BAD_ADDRESSES.length; i++) {
+        for (String badAddress : BAD_ADDRESSES) {
             try {
-                a = new MailAddress(BAD_ADDRESSES[i]);
-                fail(BAD_ADDRESSES[i]);
+                a = new MailAddress(badAddress);
+                fail(badAddress);
             } catch (AddressException ignore) {
             }
         }

Modified: james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/Runner.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/Runner.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/Runner.java (original)
+++ james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/Runner.java Tue Jan 26 10:49:49 2016
@@ -109,8 +109,8 @@ public class Runner {
             continuation.session = postElements;
             postElements.runSessions(sessions);
         } finally {
-            for (int i = 0; i < sessions.length; i++) {
-                sessions[i].stop();
+            for (Session session : sessions) {
+                session.stop();
             }
         }
     }

Modified: james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java (original)
+++ james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java Tue Jan 26 10:49:49 2016
@@ -1387,10 +1387,10 @@ public class ScriptBuilder {
             lineBuffer.flip();
             final String text = lineBuffer.toString();
             String[] lines = text.split("\r\n");
-            for (int i = 0; i < lines.length; i++) {
-                String line = StringUtils.chomp(lines[i]);
-                if (!ignoreLine(line)) {
-                    final String[] words = StringUtils.split(line);
+            for (String line : lines) {
+                String chompedLine = StringUtils.chomp(line);
+                if (!ignoreLine(chompedLine)) {
+                    final String[] words = StringUtils.split(chompedLine);
                     if (words.length > 3 && "S:".equalsIgnoreCase(words[0]) && "OK".equalsIgnoreCase(words[2])) {
                         final int commandWordIndex;
                         if (words[3] == null || !words[3].startsWith("\\[")) {
@@ -1432,26 +1432,26 @@ public class ScriptBuilder {
                             commandOkPhrase = null;
                         }
                         if (commandOkPhrase != null) {
-                            line = words[0] + " "  + words[1] + " " + commandOkPhrase;
+                            chompedLine = words[0] + " " + words[1] + " " + commandOkPhrase;
                         }
                     }
-                    line = StringUtils.replace(line, "\\\\Seen \\\\Draft",
-                    "\\\\Draft \\\\Seen");
-                    line = StringUtils.replace(line, "\\\\Flagged \\\\Deleted",
-                    "\\\\Deleted \\\\Flagged");
-                    line = StringUtils.replace(line, "\\\\Flagged \\\\Draft",
-                    "\\\\Draft \\\\Flagged");
-                    line = StringUtils.replace(line, "\\\\Seen \\\\Recent",
-                    "\\\\Recent \\\\Seen");
-                    line = StringUtils.replace(line, "\\] First unseen\\.",
-                    "\\](.)*");
-                    if (line.startsWith("S: \\* OK \\[UIDVALIDITY ")) {
-                        line = "S: \\* OK \\[UIDVALIDITY \\d+\\]";
-                    } else if (line.startsWith("S: \\* OK \\[UIDNEXT")) {
-                        line = "S: \\* OK \\[PERMANENTFLAGS \\(\\\\Answered \\\\Deleted \\\\Draft \\\\Flagged \\\\Seen\\)\\]";
+                    chompedLine = StringUtils.replace(chompedLine, "\\\\Seen \\\\Draft",
+                        "\\\\Draft \\\\Seen");
+                    chompedLine = StringUtils.replace(chompedLine, "\\\\Flagged \\\\Deleted",
+                        "\\\\Deleted \\\\Flagged");
+                    chompedLine = StringUtils.replace(chompedLine, "\\\\Flagged \\\\Draft",
+                        "\\\\Draft \\\\Flagged");
+                    chompedLine = StringUtils.replace(chompedLine, "\\\\Seen \\\\Recent",
+                        "\\\\Recent \\\\Seen");
+                    chompedLine = StringUtils.replace(chompedLine, "\\] First unseen\\.",
+                        "\\](.)*");
+                    if (chompedLine.startsWith("S: \\* OK \\[UIDVALIDITY ")) {
+                        chompedLine = "S: \\* OK \\[UIDVALIDITY \\d+\\]";
+                    } else if (chompedLine.startsWith("S: \\* OK \\[UIDNEXT")) {
+                        chompedLine = "S: \\* OK \\[PERMANENTFLAGS \\(\\\\Answered \\\\Deleted \\\\Draft \\\\Flagged \\\\Seen\\)\\]";
                     }
 
-                    System.out.println(line);
+                    System.out.println(chompedLine);
                 }
             }
             lineBuffer.clear();
@@ -1459,8 +1459,8 @@ public class ScriptBuilder {
 
         private boolean ignoreLine(String line) {
             boolean result = false;
-            for (int i = 0; i < IGNORE_LINES_CONTAINING.length; i++) {
-                if (line.indexOf(IGNORE_LINES_CONTAINING[i]) > 0) {
+            for (String entry : IGNORE_LINES_CONTAINING) {
+                if (line.indexOf(entry) > 0) {
                     result = true;
                     break;
                 }

Modified: james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/protocol/ProtocolSession.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/protocol/ProtocolSession.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/protocol/ProtocolSession.java (original)
+++ james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/protocol/ProtocolSession.java Tue Jan 26 10:49:49 2016
@@ -237,8 +237,7 @@ public class ProtocolSession implements
          */
         public void testProtocol(Session[] sessions, boolean continueAfterFailure) throws Exception {
             if (sessionNumber < 0) {
-                for (int i = 0; i < sessions.length; i++) {
-                    Session session = sessions[i];
+                for (Session session : sessions) {
                     writeMessage(session);
                 }
             }
@@ -318,8 +317,7 @@ public class ProtocolSession implements
          */
         public void testProtocol(Session[] sessions, boolean continueAfterFailure) throws Exception {
             if (sessionNumber < 0) {
-                for (int i = 0; i < sessions.length; i++) {
-                    Session session = sessions[i];
+                for (Session session : sessions) {
                     checkResponse(session, continueAfterFailure);
                 }
             }

Modified: james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/script/AbstractProtocolTestFramework.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/script/AbstractProtocolTestFramework.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/script/AbstractProtocolTestFramework.java (original)
+++ james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/script/AbstractProtocolTestFramework.java Tue Jan 26 10:49:49 2016
@@ -106,8 +106,8 @@ public abstract class AbstractProtocolTe
             postElements.runSessions(sessions);
         }
         finally {
-            for (int i = 0; i < sessions.length; i++) {
-                sessions[i].stop();
+            for (Session session : sessions) {
+                session.stop();
             }
         }
     }

Modified: james/project/trunk/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java (original)
+++ james/project/trunk/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java Tue Jan 26 10:49:49 2016
@@ -149,13 +149,12 @@ public class JCRHostSystem extends James
         if (home.exists()) {
             File[] files = home.listFiles();
             if (files == null) return;
-            for (int i = 0;i < files.length; i++) {
-                File f = files[i];
+            for (File f : files) {
                 if (f.isDirectory()) {
                     delete(f);
                 } else {
                     f.delete();
-                }            
+                }
             }
             home.delete();
         }

Modified: james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java (original)
+++ james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java Tue Jan 26 10:49:49 2016
@@ -97,24 +97,23 @@ public class MailProtocolTest implements
     */
 	public void execute() throws MojoExecutionException, MojoFailureException {
 		validate();
-		
-    
-		for (int i = 0; i < addUsers.length; i++) {
-			AddUser addUser = (AddUser) addUsers[i];
-			  try {
-		            
-		            final Reader reader; 
-		            if (addUser.getScriptText() != null) {
-		            	reader = new StringReader(addUser.getScriptText());
-		            } else {
-		            	reader = new FileReader(addUser.getScriptFile());
-		            }
-		            final ScriptedUserAdder adder = new ScriptedUserAdder(addUser.getHost(), addUser.getPort(), this);
-		            adder.addUser(addUser.getUser(), addUser.getPasswd(), reader);
-		        } catch (Exception e) {
-		            //getLog().error("Unable to add user", e);
-		            throw new MojoFailureException("User addition failed: \n" + e.getMessage());
-		        }
+
+
+		for (AddUser addUser : addUsers) {
+			try {
+
+				final Reader reader;
+				if (addUser.getScriptText() != null) {
+					reader = new StringReader(addUser.getScriptText());
+				} else {
+					reader = new FileReader(addUser.getScriptFile());
+				}
+				final ScriptedUserAdder adder = new ScriptedUserAdder(addUser.getHost(), addUser.getPort(), this);
+				adder.addUser(addUser.getUser(), addUser.getPasswd(), reader);
+			} catch (Exception e) {
+				//getLog().error("Unable to add user", e);
+				throw new MojoFailureException("User addition failed: \n" + e.getMessage());
+			}
 		}
        final Runner runner = new Runner();
        InputStream inputStream;
@@ -148,21 +147,20 @@ public class MailProtocolTest implements
 		if (scriptFile.exists() == false ) {
            throw new MojoFailureException("'scriptFile' not exists");
 		}
-		
-		for (int i = 0; i < addUsers.length; i++) {
-			AddUser addUser = (AddUser)addUsers[i];
-			
+
+		for (AddUser addUser : addUsers) {
+
 			if (addUser.getScriptText() == null && addUser.getScriptFile() == null) {
-	            throw new MojoFailureException("AddUser must contain the text of the script or a scriptFile");
-	        }
-	        
-	        if (addUser.getPort() <= 0) {
-	            throw new MojoFailureException("'port' attribute must be set on AddUser to the port against which the script should run.");
-	        }
-	        
-	        if (addUser.getHost() == null) {
-	            throw new MojoFailureException("'host' attribute must be set on AddUser to the host against which the script should run.");
-	        }
+				throw new MojoFailureException("AddUser must contain the text of the script or a scriptFile");
+			}
+
+			if (addUser.getPort() <= 0) {
+				throw new MojoFailureException("'port' attribute must be set on AddUser to the port against which the script should run.");
+			}
+
+			if (addUser.getHost() == null) {
+				throw new MojoFailureException("'host' attribute must be set on AddUser to the host against which the script should run.");
+			}
 		}
 		
 	}

Modified: james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java (original)
+++ james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java Tue Jan 26 10:49:49 2016
@@ -39,8 +39,7 @@ public class MailProtocolTestMojo extend
     private MailProtocolTest[] mailProtocolTests;
 
 	public void execute() throws MojoExecutionException, MojoFailureException {
-		for (int i = 0; i < mailProtocolTests.length; i++) {
-			MailProtocolTest test = mailProtocolTests[i];
+		for (MailProtocolTest test : mailProtocolTests) {
 			test.execute();
 		}
 	}

Modified: james/project/trunk/protocols/api/src/main/java/org/apache/james/protocols/api/handler/AbstractProtocolHandlerChain.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/api/src/main/java/org/apache/james/protocols/api/handler/AbstractProtocolHandlerChain.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/api/src/main/java/org/apache/james/protocols/api/handler/AbstractProtocolHandlerChain.java (original)
+++ james/project/trunk/protocols/api/src/main/java/org/apache/james/protocols/api/handler/AbstractProtocolHandlerChain.java Tue Jan 26 10:49:49 2016
@@ -18,7 +18,6 @@
  ****************************************************************/
 package org.apache.james.protocols.api.handler;
 
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -44,10 +43,9 @@ public abstract class AbstractProtocolHa
     public <T> LinkedList<T> getHandlers(Class<T> type) {
         LinkedList<T> result = new LinkedList<T>();
         List<ProtocolHandler> handlers = getHandlers();
-        for (Iterator<?> i = handlers.iterator(); i.hasNext(); ) {
-            Object handler = i.next();
+        for (ProtocolHandler handler : handlers) {
             if (type.isInstance(handler)) {
-                result.add((T)handler);
+                result.add((T) handler);
             }
         }
         return result;
@@ -61,15 +59,13 @@ public abstract class AbstractProtocolHa
      */
     public void wireExtensibleHandlers() throws WiringException {
         List<ProtocolHandler> handlers = getHandlers();
-        for (Iterator<?> h = handlers.iterator(); h.hasNext(); ) {
-            Object handler = h.next();
+        for (ProtocolHandler handler : handlers) {
             if (handler instanceof ExtensibleHandler) {
                 final ExtensibleHandler extensibleHandler = (ExtensibleHandler) handler;
                 final List<Class<?>> markerInterfaces = extensibleHandler.getMarkerInterfaces();
-                for (int i= 0;i < markerInterfaces.size(); i++) {
-                    final Class<?> markerInterface = markerInterfaces.get(i);
+                for (final Class<?> markerInterface : markerInterfaces) {
                     final List<?> extensions = getHandlers(markerInterface);
-                    extensibleHandler.wireExtensions(markerInterface,extensions);
+                    extensibleHandler.wireExtensions(markerInterface, extensions);
                 }
             }
         }

Modified: james/project/trunk/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java?rev=1726771&r1=1726770&r2=1726771&view=diff
==============================================================================
--- james/project/trunk/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java (original)
+++ james/project/trunk/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java Tue Jan 26 10:49:49 2016
@@ -116,18 +116,18 @@ public class CommandDispatcher<Session e
      * @see org.apache.james.protocols.api.handler.ExtensibleHandler#wireExtensions(java.lang.Class, java.util.List)
      */
     @SuppressWarnings({ "unchecked", "rawtypes" })
-    public void wireExtensions(Class interfaceName, List extension) throws WiringException {
+    public void wireExtensions(Class interfaceName, List extensions) throws WiringException {
         if (interfaceName.equals(ProtocolHandlerResultHandler.class)) {
-            rHandlers.addAll(extension);
+            rHandlers.addAll(extensions);
         }
         if (interfaceName.equals(CommandHandler.class)) {
-            for (Iterator it = extension.iterator(); it.hasNext();) {
-                CommandHandler handler = (CommandHandler) it.next();
+            for (Object extension : extensions) {
+                CommandHandler handler = (CommandHandler) extension;
                 Collection implCmds = handler.getImplCommands();
 
-                for (Iterator i = implCmds.iterator(); i.hasNext();) {
-                    String commandName = ((String) i.next()).trim().toUpperCase(Locale.US);
-                    addToMap(commandName, (CommandHandler) handler);
+                for (Object implCmd : implCmds) {
+                    String commandName = ((String) implCmd).trim().toUpperCase(Locale.US);
+                    addToMap(commandName, handler);
                 }
             }
             



---------------------------------------------------------------------
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