You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/11/14 02:09:31 UTC

[james-project] 14/32: [Refactoring] StatusCommandParser: char validator can be a constant

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 70696f752aa7e71497f75a10e70dec1839404f9e
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Nov 13 11:58:13 2019 +0700

    [Refactoring] StatusCommandParser: char validator can be a constant
---
 .../org/apache/james/imap/decode/parser/StatusCommandParser.java  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StatusCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StatusCommandParser.java
index 03262f4..660256d 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StatusCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StatusCommandParser.java
@@ -29,7 +29,6 @@ import org.apache.james.imap.api.message.StatusDataItems;
 import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.decode.DecodingException;
 import org.apache.james.imap.decode.ImapRequestLineReader;
-import org.apache.james.imap.decode.ImapRequestLineReader.CharacterValidator;
 import org.apache.james.imap.decode.base.AbstractImapCommandParser;
 import org.apache.james.imap.message.request.StatusRequest;
 
@@ -41,6 +40,8 @@ import com.google.common.collect.ImmutableList;
  * Parse STATUS commands
  */
 public class StatusCommandParser extends AbstractImapCommandParser {
+    private static final ImapRequestLineReader.NoopCharValidator NOOP_CHAR_VALIDATOR = new ImapRequestLineReader.NoopCharValidator();
+
     public StatusCommandParser() {
         super(ImapCommand.authenticatedStateCommand(ImapConstants.STATUS_COMMAND_NAME));
     }
@@ -68,12 +69,11 @@ public class StatusCommandParser extends AbstractImapCommandParser {
 
         request.nextWordChar();
         request.consumeChar('(');
-        CharacterValidator validator = new ImapRequestLineReader.NoopCharValidator();
-        String nextWord = request.consumeWord(validator);
+        String nextWord = request.consumeWord(NOOP_CHAR_VALIDATOR);
 
         while (!nextWord.endsWith(")")) {
             words.add(nextWord);
-            nextWord = request.consumeWord(validator);
+            nextWord = request.consumeWord(NOOP_CHAR_VALIDATOR);
         }
         // Got the closing ")", may be attached to a word.
         if (nextWord.length() > 1) {


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