Tabnine Logo
MailboxExistsException
Code IndexAdd Tabnine to your IDE (free)

How to use
MailboxExistsException
in
org.apache.james.mailbox.exception

Best Java code snippets using org.apache.james.mailbox.exception.MailboxExistsException (Showing top 7 results out of 315)

origin: org.apache.james/apache-james-mailbox-jpa

/**
 * Commit the transaction. If the commit fails due a conflict in a unique key constraint a {@link MailboxExistsException}
 * will get thrown
 */
@Override
protected void commit() throws MailboxException {
  try {
    getEntityManager().getTransaction().commit();
  } catch (PersistenceException e) {
    if (e instanceof EntityExistsException) {
      throw new MailboxExistsException(lastMailboxName);
    }
    if (e instanceof RollbackException) {
      Throwable t = e.getCause();
      if (t != null && t instanceof EntityExistsException) {
        throw new MailboxExistsException(lastMailboxName);
      }
    }
    throw new MailboxException("Commit of transaction failed", e);
  }
}

origin: apache/james-project

public String toString() {
  return getMessage();
}
origin: org.apache.james/apache-james-mailbox-cassandra

@Override
public MailboxId save(Mailbox mailbox) throws MailboxException {
  Preconditions.checkArgument(mailbox instanceof SimpleMailbox);
  SimpleMailbox cassandraMailbox = (SimpleMailbox) mailbox;
  CassandraId cassandraId = retrieveId(cassandraMailbox);
  cassandraMailbox.setMailboxId(cassandraId);
  boolean applied = trySave(cassandraMailbox, cassandraId).join();
  if (!applied) {
    throw new MailboxExistsException(mailbox.generateAssociatedPath().asString());
  }
  return cassandraId;
}
origin: org.apache.james/apache-james-mailbox-memory

@Override
public MailboxId save(Mailbox mailbox) throws MailboxException {
  InMemoryId id = (InMemoryId) mailbox.getMailboxId();
  if (id == null) {
    id = InMemoryId.of(mailboxIdGenerator.incrementAndGet());
    mailbox.setMailboxId(id);
  } else {
    try {
      Mailbox mailboxWithPreviousName = findMailboxById(id);
      mailboxesByPath.remove(mailboxWithPreviousName.generateAssociatedPath());
    } catch (MailboxNotFoundException e) {
      // No need to remove the previous mailbox
    }
  }
  Mailbox previousMailbox = mailboxesByPath.putIfAbsent(mailbox.generateAssociatedPath(), mailbox);
  if (previousMailbox != null) {
    throw new MailboxExistsException(mailbox.getName());
  }
  return mailbox.getMailboxId();
}
origin: org.apache.james/apache-james-mailbox-store

@Override
public void renameMailbox(MailboxPath from, MailboxPath to, MailboxSession session) throws MailboxException {
  LOGGER.debug("renameMailbox {} to {}", from, to);
  if (mailboxExists(to, session)) {
    throw new MailboxExistsException(to.toString());
  }
  if (isMailboxNameTooLong(to)) {
    throw new TooLongMailboxNameException("Mailbox name exceed maximum size of " + MAX_MAILBOX_NAME_LENGTH + " characters");
  }
  assertIsOwner(session, from);
  MailboxMapper mapper = mailboxSessionMapperFactory.getMailboxMapper(session);
  mapper.execute(Mapper.toTransaction(() -> doRenameMailbox(from, to, session, mapper)));
}
origin: org.apache.james/apache-james-mailbox-store

throw new MailboxExistsException(sanitizedMailboxPath.asString());
origin: org.apache.james/apache-james-mailbox-jpa

@Override
public MailboxId save(Mailbox mailbox) throws MailboxException {
  try {
    if (isPathAlreadyUsedByAnotherMailbox(mailbox)) {
      throw new MailboxExistsException(mailbox.getName());
    }
    this.lastMailboxName = mailbox.getName();
    JPAMailbox persistedMailbox = JPAMailbox.from(mailbox);
    getEntityManager().persist(persistedMailbox);
    if (!(mailbox instanceof JPAMailbox)) {
      mailbox.setMailboxId(persistedMailbox.getMailboxId());
    }
    return mailbox.getMailboxId();
  } catch (PersistenceException e) {
    throw new MailboxException("Save of mailbox " + mailbox.getName() + " failed", e);
  } 
}
org.apache.james.mailbox.exceptionMailboxExistsException

Javadoc

Indicates that the operation failed since the mailbox already exists.

Most used methods

  • <init>
  • getMessage

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • getSupportFragmentManager (FragmentActivity)
  • onRequestPermissionsResult (Fragment)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • JFileChooser (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now