You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/03/22 02:03:53 UTC

[james-project] 24/25: JAMES-3722 Parse an arbitrary number of IMAP FETCH modifiers

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit b66294df3d4282f51b39744e290e288f537940f3
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu Mar 17 16:34:52 2022 +0700

    JAMES-3722 Parse an arbitrary number of IMAP FETCH modifiers
---
 .../james/imap/decode/parser/FetchCommandParser.java      | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java
index f006dd2..b878f6f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java
@@ -84,10 +84,9 @@ public class FetchCommandParser extends AbstractUidCommandParser {
             next = nextNonSpaceChar(request);
             if (next == '(') {
                 request.consumeChar('(');
-                parseModifier(request, fetch);
-                nextNonSpaceChar(request);
-                parseModifier(request, fetch);
-                nextNonSpaceChar(request);
+                while (parseModifier(request, fetch)) {
+                    nextNonSpaceChar(request);
+                }
                 request.consumeChar(')');
             }
         } else {
@@ -97,21 +96,21 @@ public class FetchCommandParser extends AbstractUidCommandParser {
         return fetch.build();
     }
 
-    private void parseModifier(ImapRequestLineReader request, FetchData.Builder fetch) throws DecodingException {
+    private boolean parseModifier(ImapRequestLineReader request, FetchData.Builder fetch) throws DecodingException {
         char next = request.nextChar();
         switch (next) {
         case 'C':
             // Now check for the CHANGEDSINCE option which is part of CONDSTORE
             request.consumeWord(StringMatcherCharacterValidator.ignoreCase(CHANGEDSINCE));
             fetch.changedSince(request.number(true));
-            break;
+            return true;
         case 'V':
             // Check for the VANISHED option which is part of QRESYNC
             request.consumeWord(StringMatcherCharacterValidator.ignoreCase(VANISHED), true);
             fetch.vanished(true);
-            break;
+            return true;
         default:
-            break;
+            return false;
         }
     }
 

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