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 8b8a86a3c6b4d46738f7b24e390bd2ae362c88a9
Author: Benoit Tellier <btell...@linagora.com>
AuthorDate: Thu Dec 12 08:51:33 2019 +0100

    [Refactoring] Enhance code style in AbstractMailboxProcessor
    
     - Avoid a reversed condition
---
 .../apache/james/imap/processor/AbstractMailboxProcessor.java    | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
index 5380767..bba3072 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
@@ -89,16 +89,15 @@ public abstract class AbstractMailboxProcessor<R extends 
ImapRequest> extends Ab
     protected final void doProcess(R acceptableMessage, Responder responder, 
ImapSession session) {
         TimeMetric timeMetric = metricFactory.timer(IMAP_PREFIX + 
acceptableMessage.getCommand().getName());
         try {
-            if 
(!acceptableMessage.getCommand().validForState(session.getState())) {
-                ImapResponseMessage response = 
factory.taggedNo(acceptableMessage.getTag(), acceptableMessage.getCommand(), 
HumanReadableText.INVALID_COMMAND);
-                responder.respond(response);
-
-            } else {
+            if 
(acceptableMessage.getCommand().validForState(session.getState())) {
                 
getMailboxManager().startProcessingRequest(session.getMailboxSession());
 
                 processRequest(acceptableMessage, session, responder);
 
                 
getMailboxManager().endProcessingRequest(session.getMailboxSession());
+            } else {
+                ImapResponseMessage response = 
factory.taggedNo(acceptableMessage.getTag(), acceptableMessage.getCommand(), 
HumanReadableText.INVALID_COMMAND);
+                responder.respond(response);
             }
         } catch (DeniedAccessOnSharedMailboxException e) {
             no(acceptableMessage, responder, 
HumanReadableText.DENIED_SHARED_MAILBOX);


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

Reply via email to