This is an automated email from the ASF dual-hosted git repository. rcordier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 65d2901ca5fa875f6a26dbdde83e92917fe3fe91 Author: Benoit TELLIER <btell...@linagora.com> AuthorDate: Fri Oct 11 09:02:42 2024 +0200 JAMES-2182 Fix InMemorySecurityTest --- .../org/apache/james/imap/processor/CreateProcessor.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java index 377f5726f0..5103cca2cd 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java @@ -28,9 +28,9 @@ import org.apache.james.imap.api.process.ImapSession; import org.apache.james.imap.main.PathConverter; import org.apache.james.imap.message.request.CreateRequest; import org.apache.james.mailbox.MailboxManager; +import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.exception.MailboxExistsException; import org.apache.james.mailbox.exception.TooLongMailboxNameException; -import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.metrics.api.MetricFactory; import org.apache.james.util.MDCBuilder; import org.apache.james.util.ReactorUtils; @@ -55,21 +55,21 @@ public class CreateProcessor extends AbstractMailboxProcessor<CreateRequest> { protected Mono<Void> processRequestReactive(CreateRequest request, ImapSession session, Responder responder) { MailboxManager mailboxManager = getMailboxManager(); - MailboxPath mailboxPath = pathConverterFactory.forSession(session).buildFullPath(request.getMailboxName()); - return Mono.from(mailboxManager.createMailboxReactive(mailboxPath, session.getMailboxSession())) + return Mono.fromCallable(() -> pathConverterFactory.forSession(session).buildFullPath(request.getMailboxName())) + .flatMap(mailboxPath -> Mono.from(mailboxManager.createMailboxReactive(mailboxPath, session.getMailboxSession()))) .flatMap(mailboxId -> unsolicitedResponses(session, responder, false) .then(Mono.fromRunnable(() -> okComplete(request, StatusResponse.ResponseCode.mailboxId(mailboxId), responder)))) .onErrorResume(MailboxExistsException.class, e -> { no(request, responder, HumanReadableText.MAILBOX_EXISTS); - return ReactorUtils.logAsMono(() -> LOGGER.debug("Create failed for mailbox {} as it already exists", mailboxPath, e)); + return ReactorUtils.logAsMono(() -> LOGGER.debug("Create failed for mailbox {} as it already exists", request.getMailboxName(), e)); }) .onErrorResume(TooLongMailboxNameException.class, e -> { taggedBad(request, responder, HumanReadableText.FAILURE_MAILBOX_NAME); - return ReactorUtils.logAsMono(() -> LOGGER.debug("The mailbox name length is over limit: {}", mailboxPath.getName(), e)); + return ReactorUtils.logAsMono(() -> LOGGER.debug("The mailbox name length is over limit: {}", request.getMailboxName(), e)); }) - .onErrorResume(TooLongMailboxNameException.class, e -> { + .onErrorResume(MailboxException.class, e -> { no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING); - return ReactorUtils.logAsMono(() -> LOGGER.error("Create failed for mailbox {}", mailboxPath, e)); + return ReactorUtils.logAsMono(() -> LOGGER.error("Create failed for mailbox {}", request.getMailboxName(), e)); }) .then(); } --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org