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 2023/06/18 14:46:50 UTC

[james-project] 02/02: Skip retry PropagateLookupRightListener when mailbox not found

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 6bceb0a2cc3f0a96bf9801f272382a4abb3db253
Author: Tung Van TRAN <vt...@linagora.com>
AuthorDate: Fri Jun 16 08:14:19 2023 +0700

    Skip retry PropagateLookupRightListener when mailbox not found
---
 .../org/apache/james/jmap/event/PropagateLookupRightListener.java    | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java
index 0d02571e19..1a53c515e9 100644
--- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java
+++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java
@@ -35,6 +35,7 @@ import org.apache.james.mailbox.RightManager;
 import org.apache.james.mailbox.acl.ACLDiff;
 import org.apache.james.mailbox.events.MailboxEvents.MailboxACLUpdated;
 import org.apache.james.mailbox.events.MailboxEvents.MailboxRenamed;
+import org.apache.james.mailbox.exception.MailboxNotFoundException;
 import org.apache.james.mailbox.model.MailboxACL;
 import org.apache.james.mailbox.model.MailboxACL.Entry;
 import org.apache.james.mailbox.model.MailboxACL.Right;
@@ -95,6 +96,10 @@ public class PropagateLookupRightListener implements EventListener.ReactiveGroup
     private Mono<Void> updateLookupRightOnParent(MailboxRenamed mailboxRenamed) {
         MailboxSession mailboxSession = createMailboxSession(mailboxRenamed);
         return Mono.from(rightManager.listRightsReactive(mailboxRenamed.getNewPath(), mailboxSession))
+            .onErrorResume(MailboxNotFoundException.class, e -> {
+                LOGGER.info("Mailbox {} not found, skip lookup right update", mailboxRenamed.getNewPath());
+                return Mono.empty();
+            })
             .flatMapIterable(acl -> acl.getEntries().entrySet())
             .map(mapEntry -> new Entry(mapEntry.getKey(), mapEntry.getValue()))
             .filter(updateLookupRightPredicate())


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