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 3a493d38a0452d35e3c7754c70e1f656770d758a
Author: Benoit TELLIER <btell...@linagora.com>
AuthorDate: Wed Mar 13 15:39:45 2024 +0100

    [FIX] MailboxChangeListener should not warn on deleted mailbox
---
 .../org/apache/james/jmap/change/MailboxChangeListener.scala  | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/change/MailboxChangeListener.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/change/MailboxChangeListener.scala
index e12adfd57b..bc08e089c9 100644
--- 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/change/MailboxChangeListener.scala
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/change/MailboxChangeListener.scala
@@ -34,6 +34,7 @@ import org.apache.james.jmap.core.UuidState
 import org.apache.james.mailbox.MailboxManager
 import org.apache.james.mailbox.events.MailboxEvents
 import org.apache.james.mailbox.events.MailboxEvents.{Added, Expunged, 
FlagsUpdated, MailboxACLUpdated, MailboxAdded, MailboxDeletion, MailboxEvent, 
MailboxRenamed}
+import org.apache.james.mailbox.exception.{MailboxException, 
MailboxNotFoundException}
 import org.apache.james.mailbox.model.{MailboxACL, MailboxId}
 import org.apache.james.util.ReactorUtils.DEFAULT_CONCURRENCY
 import org.reactivestreams.Publisher
@@ -117,9 +118,13 @@ case class MailboxChangeListener @Inject() 
(@Named(InjectionKeys.JMAP) eventBus:
         .map(_.getName)
         .map(AccountId.fromString)
         .toList)
-      .onErrorResume(e => {
-        LOGGER.warn("Could not get sharees for mailbox [%s] when listening to 
change events", mailboxId, e)
-        SMono.just(List.empty)
+      .onErrorResume({
+        case e: MailboxNotFoundException =>
+          LOGGER.warn("Could not get sharees for mailbox {} as the mailbox was 
deleted", mailboxId)
+          SMono.just(List.empty)
+        case e =>
+          LOGGER.warn("Could not get sharees for mailbox {} when listening to 
change events", mailboxId, e)
+          SMono.just(List.empty)
       })
   }
 


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

Reply via email to