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 ad...@apache.org on 2018/08/30 13:15:54 UTC

[12/26] james-project git commit: JAMES-2529 Handling all mailbox exceptions while resolving mailbox name

JAMES-2529 Handling all mailbox exceptions while resolving mailbox name


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/1e2124e0
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/1e2124e0
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/1e2124e0

Branch: refs/heads/master
Commit: 1e2124e0ee253bbfb6942740546e6422996dfdfe
Parents: c6a6e97
Author: Benoit Tellier <bt...@linagora.com>
Authored: Thu Aug 30 14:01:10 2018 +0700
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Thu Aug 30 15:07:03 2018 +0200

----------------------------------------------------------------------
 .../org/apache/james/jmap/mailet/filter/ActionApplier.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/1e2124e0/server/protocols/jmap/src/main/java/org/apache/james/jmap/mailet/filter/ActionApplier.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/mailet/filter/ActionApplier.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/mailet/filter/ActionApplier.java
index 7006801..72376ab 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/mailet/filter/ActionApplier.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/mailet/filter/ActionApplier.java
@@ -28,14 +28,12 @@ import org.apache.james.jmap.api.filtering.Rule;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
-import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.exception.MailboxNotFoundException;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.mailet.Mail;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.github.fge.lambdas.Throwing;
 import com.google.common.annotations.VisibleForTesting;
 
 public class ActionApplier {
@@ -90,10 +88,10 @@ public class ActionApplier {
     public void apply(Stream<Rule.Action> actions) {
         actions.flatMap(action -> action.getAppendInMailboxes().getMailboxIds().stream())
             .map(mailboxIdFactory::fromString)
-            .forEach(Throwing.consumer(this::addStorageDirective));
+            .forEach(this::addStorageDirective);
     }
 
-    private void addStorageDirective(MailboxId mailboxId) throws MailboxException {
+    private void addStorageDirective(MailboxId mailboxId) {
         try {
             MailboxSession mailboxSession = mailboxManager.createSystemSession(user.asString());
             MessageManager messageManager = mailboxManager.getMailbox(mailboxId, mailboxSession);
@@ -103,6 +101,8 @@ public class ActionApplier {
             mail.setAttribute(attributeNameForUser, mailboxName);
         } catch (MailboxNotFoundException e) {
             LOGGER.info("Mailbox {} does not exist, but it was mentioned in a JMAP filtering rule", mailboxId, e);
+        } catch (Exception e) {
+            LOGGER.error("Unexpected failure while resolving mailbox name for {}", mailboxId, e);
         }
     }
 }


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