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 62808ab5d670aeec5550b704472176e6f6e2a2d5 Author: Benoit Tellier <btell...@linagora.com> AuthorDate: Fri Nov 8 14:16:23 2019 +0700 JAMES-2939 Fix unstable DefaultMailboxesProvisioningFilterTest --- .../james/mailbox/exception/InboxAlreadyCreated.java | 16 ++-------------- .../draft/methods/SetMailboxesCreationProcessor.java | 12 ++++++------ 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/exception/InboxAlreadyCreated.java b/mailbox/api/src/main/java/org/apache/james/mailbox/exception/InboxAlreadyCreated.java index c673c39..a731ac4 100644 --- a/mailbox/api/src/main/java/org/apache/james/mailbox/exception/InboxAlreadyCreated.java +++ b/mailbox/api/src/main/java/org/apache/james/mailbox/exception/InboxAlreadyCreated.java @@ -23,24 +23,12 @@ package org.apache.james.mailbox.exception; /** * Indicates that the operation failed since INBOX already exists. */ -public class InboxAlreadyCreated extends MailboxException { +public class InboxAlreadyCreated extends MailboxExistsException { private static final long serialVersionUID = -486251759505030366L; - private final String mailboxName; - public InboxAlreadyCreated(String mailboxName) { - super("The mailbox '" + mailboxName + "' already exists as 'INBOX'"); - this.mailboxName = mailboxName; - } - - /** - * Gets the name of the mailbox which already exists. - * - * @return the mailboxName, not null - */ - public final String getMailboxName() { - return mailboxName; + super(mailboxName); } public String toString() { diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/SetMailboxesCreationProcessor.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/SetMailboxesCreationProcessor.java index 7663c5b..f0e56d6 100644 --- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/SetMailboxesCreationProcessor.java +++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/SetMailboxesCreationProcessor.java @@ -148,12 +148,6 @@ public class SetMailboxesCreationProcessor implements SetMailboxesProcessor { .type(SetError.Type.INVALID_ARGUMENTS) .description(e.getMessage()) .build()); - } catch (MailboxExistsException e) { - String message = String.format("The mailbox '%s' already exists.", mailboxCreationId.getCreationId()); - builder.notCreated(mailboxCreationId, SetError.builder() - .type(SetError.Type.INVALID_ARGUMENTS) - .description(message) - .build()); } catch (InboxAlreadyCreated e) { String message = String.format("The mailbox '%s' already exists as 'INBOX'", e.getMailboxName()); LOGGER.error(message, e); @@ -161,6 +155,12 @@ public class SetMailboxesCreationProcessor implements SetMailboxesProcessor { .type(SetError.Type.INVALID_ARGUMENTS) .description(message) .build()); + } catch (MailboxExistsException e) { + String message = String.format("The mailbox '%s' already exists.", mailboxCreationId.getCreationId()); + builder.notCreated(mailboxCreationId, SetError.builder() + .type(SetError.Type.INVALID_ARGUMENTS) + .description(message) + .build()); } catch (MailboxException e) { String message = String.format("An error occurred when creating the mailbox '%s'", mailboxCreationId.getCreationId()); LOGGER.error(message, e); --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org