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/12/13 02:39:32 UTC

[james-project] 16/27: PROTOCOLS-120 AbstractImapCommandParser statusResponseFactory field should be private

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 8f999dc024decf9d6d55f7d9be6afbc3564bf152
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Dec 9 10:25:34 2019 +0700

    PROTOCOLS-120 AbstractImapCommandParser statusResponseFactory field should be private
---
 .../apache/james/imap/decode/base/AbstractImapCommandParser.java   | 7 ++++++-
 .../org/apache/james/imap/decode/parser/SearchCommandParser.java   | 2 +-
 .../imap/decode/parser/FetchCommandParserPartialFetchTest.java     | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/base/AbstractImapCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/base/AbstractImapCommandParser.java
index 0e17dc2..b49c5a5 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/base/AbstractImapCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/base/AbstractImapCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
 import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
+import org.apache.james.imap.api.message.response.StatusResponse;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.decode.DecodingException;
@@ -42,7 +43,7 @@ public abstract class AbstractImapCommandParser implements ImapCommandParser {
 
     private final ImapCommand command;
 
-    protected final StatusResponseFactory statusResponseFactory;
+    private final StatusResponseFactory statusResponseFactory;
 
     public AbstractImapCommandParser(ImapCommand command, StatusResponseFactory statusResponseFactory) {
         this.command = command;
@@ -53,6 +54,10 @@ public abstract class AbstractImapCommandParser implements ImapCommandParser {
         return command;
     }
 
+    protected StatusResponse taggedNo(Tag tag, ImapCommand command, HumanReadableText displayTextKey, StatusResponse.ResponseCode code) {
+        return statusResponseFactory.taggedNo(tag, command, displayTextKey, code);
+    }
+
     /**
      * Parses a request into a command message for later processing.
      * 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java
index 77040d2..b25a57d 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java
@@ -904,7 +904,7 @@ public class SearchCommandParser extends AbstractUidCommandParser {
 
     private ImapMessage unsupportedCharset(Tag tag, ImapCommand command) {
         final ResponseCode badCharset = StatusResponse.ResponseCode.badCharset();
-        return statusResponseFactory.taggedNo(tag, command, HumanReadableText.BAD_CHARSET, badCharset);
+        return taggedNo(tag, command, HumanReadableText.BAD_CHARSET, badCharset);
     }
 
     /**
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/FetchCommandParserPartialFetchTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/FetchCommandParserPartialFetchTest.java
index 88e5deb..9a2b0e6 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/FetchCommandParserPartialFetchTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/FetchCommandParserPartialFetchTest.java
@@ -21,6 +21,7 @@ package org.apache.james.imap.decode.parser;
 
 import static org.apache.james.imap.ImapFixture.TAG;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.Mockito.mock;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;


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