james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r635390 - /james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/base/SelectedMailboxSessionImpl.java
Date Sun, 09 Mar 2008 22:49:46 GMT
Author: rdonkin
Date: Sun Mar  9 15:49:44 2008
New Revision: 635390

URL: http://svn.apache.org/viewvc?rev=635390&view=rev
Log:
Fixed faulty coding in flag response. Always stick to one loop per method and this kind of
bug doesn't happen.

Modified:
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/base/SelectedMailboxSessionImpl.java

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/base/SelectedMailboxSessionImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/base/SelectedMailboxSessionImpl.java?rev=635390&r1=635389&r2=635390&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/base/SelectedMailboxSessionImpl.java
(original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/base/SelectedMailboxSessionImpl.java
Sun Mar  9 15:49:44 2008
@@ -131,28 +131,32 @@
 
     private void addFlagsResponses(final List responses, boolean useUid, final ImapMailbox
mailbox) {
         try {
-            
             for (final Iterator it = events.flagUpdateUids(); it.hasNext();) {
                 Long uid = (Long) it.next();
                 GeneralMessageSet messageSet = GeneralMessageSetImpl.oneUid(uid.longValue());
-                final Iterator messages = mailbox.getMessages(messageSet, FetchGroupImpl.FLAGS,
mailboxSession);
-                while (messages.hasNext()) {
-                    MessageResult mr = (MessageResult) it.next();
-                    int msn = msn(mr.getUid());
-                    final Flags flags = mr.getFlags();
-                    final Long uidOut;
-                    if (useUid) {
-                        uidOut = new Long(mr.getUid());
-                    } else {
-                        uidOut = null;
-                    }
-                    FetchResponse response = new FetchResponse(msn, flags, uidOut, null,
null, null, null, null);
-                    responses.add(response);
-                }
+                addFlagsResponses(responses, useUid, mailbox, messageSet);
             }
         } catch (MessagingException e) {
             final String message = "Failed to retrieve flags data";
             handleResponseException(responses, e, message);
+        }
+    }
+
+    private void addFlagsResponses(final List responses, boolean useUid, final ImapMailbox
mailbox, GeneralMessageSet messageSet) throws MailboxManagerException {
+        final Iterator it = mailbox.getMessages(messageSet, FetchGroupImpl.FLAGS, mailboxSession);
+        while (it.hasNext()) {
+            MessageResult mr = (MessageResult) it.next();
+            final long uid = mr.getUid();
+            int msn = msn(uid);
+            final Flags flags = mr.getFlags();
+            final Long uidOut;
+            if (useUid) {
+                uidOut = new Long(uid);
+            } else {
+                uidOut = null;
+            }
+            FetchResponse response = new FetchResponse(msn, flags, uidOut, null, null, null,
null, null);
+            responses.add(response);
         }
     }
 



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