Tabnine Logo
MessagingException.getMessage
Code IndexAdd Tabnine to your IDE (free)

How to use
getMessage
method
in
javax.mail.MessagingException

Best Java code snippets using javax.mail.MessagingException.getMessage (Showing top 20 results out of 1,161)

origin: igniterealtime/Openfire

@Override
public void run() {
  try {
    sendMessages();
  }
  catch (MessagingException me) {
    Log.error(me.getMessage(), me);
  }
}
origin: apache/nifi

/**
 * Fills the internal message queue if such queue is empty. This is due to
 * the fact that per single session there may be multiple messages retrieved
 * from the email server (see FETCH_SIZE).
 */
private synchronized void fillMessageQueueIfNecessary() {
  if (this.messageQueue.isEmpty()) {
    Object[] messages;
    try {
      messages = this.messageReceiver.receive();
    } catch (MessagingException e) {
      String errorMsg = "Failed to receive messages from Email server: [" + e.getClass().getName()
          + " - " + e.getMessage();
      this.getLogger().error(errorMsg);
      throw new ProcessException(errorMsg, e);
    }
    if (messages != null) {
      for (Object message : messages) {
        Assert.isTrue(message instanceof Message, "Message is not an instance of javax.mail.Message");
        this.messageQueue.offer((Message) message);
      }
    }
  }
}
origin: igniterealtime/Openfire

Log.error(ae.getMessage(), ae);
origin: voldemort/voldemort

                 + e.getMessage(), e);
} catch(JsonParseException e) {
  throw new VoldemortException("JSON parsing exception while trying to parse GET response "
origin: voldemort/voldemort

                 + e.getMessage(), e);
} catch(JsonParseException e) {
  throw new VoldemortException("JSON parsing exception while trying to parse GET response "
origin: spring-projects/spring-framework

@Test
public void failedMimeMessage() throws MessagingException {
  MockJavaMailSender sender = new MockJavaMailSender();
  sender.setHost("host");
  sender.setUsername("username");
  sender.setPassword("password");
  MimeMessage mimeMessage1 = sender.createMimeMessage();
  mimeMessage1.setRecipient(Message.RecipientType.TO, new InternetAddress("he@mail.org"));
  mimeMessage1.setSubject("fail");
  MimeMessage mimeMessage2 = sender.createMimeMessage();
  mimeMessage2.setRecipient(Message.RecipientType.TO, new InternetAddress("she@mail.org"));
  try {
    sender.send(mimeMessage1, mimeMessage2);
  }
  catch (MailSendException ex) {
    ex.printStackTrace();
    assertEquals("host", sender.transport.getConnectedHost());
    assertEquals("username", sender.transport.getConnectedUsername());
    assertEquals("password", sender.transport.getConnectedPassword());
    assertTrue(sender.transport.isCloseCalled());
    assertEquals(1, sender.transport.getSentMessages().size());
    assertEquals(mimeMessage2, sender.transport.getSentMessage(0));
    assertEquals(1, ex.getFailedMessages().size());
    assertEquals(mimeMessage1, ex.getFailedMessages().keySet().iterator().next());
    Object subEx = ex.getFailedMessages().values().iterator().next();
    assertTrue(subEx instanceof MessagingException);
    assertEquals("failed", ((MessagingException) subEx).getMessage());
  }
}
origin: spring-projects/spring-framework

@Test
public void failedSimpleMessage() throws MessagingException {
  MockJavaMailSender sender = new MockJavaMailSender();
  sender.setHost("host");
  sender.setUsername("username");
  sender.setPassword("password");
  SimpleMailMessage simpleMessage1 = new SimpleMailMessage();
  simpleMessage1.setTo("he@mail.org");
  simpleMessage1.setSubject("fail");
  SimpleMailMessage simpleMessage2 = new SimpleMailMessage();
  simpleMessage2.setTo("she@mail.org");
  try {
    sender.send(simpleMessage1, simpleMessage2);
  }
  catch (MailSendException ex) {
    ex.printStackTrace();
    assertEquals("host", sender.transport.getConnectedHost());
    assertEquals("username", sender.transport.getConnectedUsername());
    assertEquals("password", sender.transport.getConnectedPassword());
    assertTrue(sender.transport.isCloseCalled());
    assertEquals(1, sender.transport.getSentMessages().size());
    assertEquals(new InternetAddress("she@mail.org"), sender.transport.getSentMessage(0).getAllRecipients()[0]);
    assertEquals(1, ex.getFailedMessages().size());
    assertEquals(simpleMessage1, ex.getFailedMessages().keySet().iterator().next());
    Object subEx = ex.getFailedMessages().values().iterator().next();
    assertTrue(subEx instanceof MessagingException);
    assertEquals("failed", ((MessagingException) subEx).getMessage());
  }
}
origin: camunda/camunda-bpm-platform

/**
 * Sets the from header to the local address.
 * @param msg the target message.
 */
private void setDefaultFrom(final Message msg) {
  try {
    msg.setFrom();
  } catch (final MessagingException ME) {
    reportError(ME.getMessage(), ME, ErrorManager.FORMAT_FAILURE);
  }
}
origin: com.sun.mail/javax.mail

/**
 * Sets the from header to the local address.
 * @param msg the target message.
 */
private void setDefaultFrom(final Message msg) {
  try {
    msg.setFrom();
  } catch (final MessagingException ME) {
    reportError(ME.getMessage(), ME, ErrorManager.FORMAT_FAILURE);
  }
}
origin: camunda/camunda-bpm-platform

/**
 * It is assumed that file names are short and that in most cases
 * getTail will be the only method that will produce a result.
 * @param part to append to.
 * @param chunk non null string to append.
 */
private void appendFileName0(final Part part, String chunk) {
  try {
    //Remove all control character groups.
    chunk = chunk.replaceAll("[\\x00-\\x1F\\x7F]+", "");
    final String old = part.getFileName();
    part.setFileName(old != null ? old.concat(chunk) : chunk);
  } catch (final MessagingException ME) {
    reportError(ME.getMessage(), ME, ErrorManager.FORMAT_FAILURE);
  }
}
origin: camunda/camunda-bpm-platform

/**
 * Sets the accept language to the default locale of the JVM.
 * If the locale is the root locale the header is not added.
 * @param p the part to set.
 * @since JavaMail 1.4.5
 */
private void setAcceptLang(final Part p) {
  try {
    final String lang = LogManagerProperties
        .toLanguageTag(Locale.getDefault());
    if (lang.length() != 0) {
      p.setHeader("Accept-Language", lang);
    }
  } catch (final MessagingException ME) {
    reportError(ME.getMessage(), ME, ErrorManager.FORMAT_FAILURE);
  }
}
origin: com.sun.mail/javax.mail

/**
 * It is assumed that file names are short and that in most cases
 * getTail will be the only method that will produce a result.
 * @param part to append to.
 * @param chunk non null string to append.
 */
private void appendFileName0(final Part part, String chunk) {
  try {
    //Remove all control character groups.
    chunk = chunk.replaceAll("[\\x00-\\x1F\\x7F]+", "");
    final String old = part.getFileName();
    part.setFileName(old != null ? old.concat(chunk) : chunk);
  } catch (final MessagingException ME) {
    reportError(ME.getMessage(), ME, ErrorManager.FORMAT_FAILURE);
  }
}
origin: camunda/camunda-bpm-platform

/**
 * Used to signal that body parts are missing from a message.  Also used
 * when LogRecords were passed to an attachment formatter but the formatter
 * produced no output, which is allowed.  Used during a verify because all
 * parts are omitted, none of the content formatters are used.  This is
 * not used when a filter prevents LogRecords from being formatted.
 * This header is defined in RFC 2156 and RFC 4021.
 * @param msg the message.
 * @since JavaMail 1.4.5
 */
private void setIncompleteCopy(final Message msg) {
  try {
    msg.setHeader("Incomplete-Copy", "");
  } catch (final MessagingException ME) {
    reportError(ME.getMessage(), ME, ErrorManager.FORMAT_FAILURE);
  }
}
origin: com.sun.mail/javax.mail

/**
 * Sets the accept language to the default locale of the JVM.
 * If the locale is the root locale the header is not added.
 * @param p the part to set.
 * @since JavaMail 1.4.5
 */
private void setAcceptLang(final Part p) {
  try {
    final String lang = LogManagerProperties
        .toLanguageTag(Locale.getDefault());
    if (lang.length() != 0) {
      p.setHeader("Accept-Language", lang);
    }
  } catch (final MessagingException ME) {
    reportError(ME.getMessage(), ME, ErrorManager.FORMAT_FAILURE);
  }
}
origin: camunda/camunda-bpm-platform

/**
 * Signals that this message was generated by automatic process.
 * This header is defined in RFC 3834 section 5.
 * @param msg the message.
 * @since JavaMail 1.4.6
 */
private void setAutoSubmitted(final Message msg) {
  if (allowRestrictedHeaders()) {
    try { //RFC 3834 (5.2)
      msg.setHeader("auto-submitted", "auto-generated");
    } catch (final MessagingException ME) {
      reportError(ME.getMessage(), ME, ErrorManager.FORMAT_FAILURE);
    }
  }
}
origin: com.sun.mail/javax.mail

/**
 * Signals that this message was generated by automatic process.
 * This header is defined in RFC 3834 section 5.
 * @param msg the message.
 * @since JavaMail 1.4.6
 */
private void setAutoSubmitted(final Message msg) {
  if (allowRestrictedHeaders()) {
    try { //RFC 3834 (5.2)
      msg.setHeader("auto-submitted", "auto-generated");
    } catch (final MessagingException ME) {
      reportError(ME.getMessage(), ME, ErrorManager.FORMAT_FAILURE);
    }
  }
}
origin: camunda/camunda-bpm-platform

/**
 * Sets the priority and importance headers.
 * @param msg the target message.
 */
private void setPriority(final Message msg) {
  try {
    msg.setHeader("Importance", "High");
    msg.setHeader("Priority", "urgent");
    msg.setHeader("X-Priority", "2"); //High
  } catch (final MessagingException ME) {
    reportError(ME.getMessage(), ME, ErrorManager.FORMAT_FAILURE);
  }
}
origin: com.sun.mail/javax.mail

/**
 * Sets the priority and importance headers.
 * @param msg the target message.
 */
private void setPriority(final Message msg) {
  try {
    msg.setHeader("Importance", "High");
    msg.setHeader("Priority", "urgent");
    msg.setHeader("X-Priority", "2"); //High
  } catch (final MessagingException ME) {
    reportError(ME.getMessage(), ME, ErrorManager.FORMAT_FAILURE);
  }
}
origin: camunda/camunda-bpm-platform

/**
 * Sets reply-to address header.
 * @param msg the target message.
 */
private void setReplyTo(final Message msg) {
  final String reply = getSession(msg).getProperty("mail.reply.to");
  if (!isEmpty(reply)) {
    try {
      final Address[] address = InternetAddress.parse(reply, false);
      if (address.length > 0) {
        msg.setReplyTo(address);
      }
    } catch (final MessagingException ME) {
      reportError(ME.getMessage(), ME, ErrorManager.FORMAT_FAILURE);
    }
  }
}
origin: com.sun.mail/javax.mail

/**
 * Sets reply-to address header.
 * @param msg the target message.
 */
private void setReplyTo(final Message msg) {
  final String reply = getSession(msg).getProperty("mail.reply.to");
  if (!isEmpty(reply)) {
    try {
      final Address[] address = InternetAddress.parse(reply, false);
      if (address.length > 0) {
        msg.setReplyTo(address);
      }
    } catch (final MessagingException ME) {
      reportError(ME.getMessage(), ME, ErrorManager.FORMAT_FAILURE);
    }
  }
}
javax.mailMessagingExceptiongetMessage

Popular methods of MessagingException

  • <init>
    Constructs a MessagingException with the specified Exception and detail message. The specified excep
  • printStackTrace
  • getNextException
    Get the next exception chained to this one. If the next exception is a MessagingException, the chain
  • toString
    Override toString method to provide information on nested exceptions.
  • setNextException
    Add an exception to the end of the chain. If the end is not a MessagingException, this exception can
  • initCause
  • getCause
    Overrides the getCause method of Throwable to return the next exception in the chain of nested excep
  • superToString
    Return the "toString" information for this exception, without any information on nested exceptions.
  • getLocalizedMessage
  • addSuppressed
  • getStackTrace
  • setStackTrace
  • getStackTrace,
  • setStackTrace

Popular in Java

  • Start an intent from android
  • getSystemService (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getApplicationContext (Context)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • JTable (javax.swing)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top PhpStorm plugins
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