站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

MailSendException (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.mail
Class MailSendException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.springframework.core.NestedRuntimeException
                  extended by org.springframework.mail.MailException
                      extended by org.springframework.mail.MailSendException
All Implemented Interfaces:
Serializable

public class MailSendException
extends MailException

Exception thrown when a mail sending error is encountered. Can register failed messages with their exceptions.

Author:
Dmitriy Kopylenko, Juergen Hoeller
See Also:
Serialized Form

Constructor Summary
MailSendException(Map failedMessages)
          Constructor for registration of failed messages, with the messages that failed as keys, and the thrown exceptions as values.
MailSendException(String msg)
          Constructor for MailSendException.
MailSendException(String msg, Throwable cause)
          Constructor for MailSendException.
 
Method Summary
 Map getFailedMessages()
          Return a Map with the failed messages as keys, and the thrown exceptions as values.
 String getMessage()
          Return the detail message, including the message from the nested exception if there is one.
 void printStackTrace(PrintStream ps)
          Print the composite message and the embedded stack trace to the specified stream.
 void printStackTrace(PrintWriter pw)
          Print the composite message and the embedded stack trace to the specified writer.
 String toString()
           
 
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getCause, getMostSpecificCause, getRootCause
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MailSendException

public MailSendException(String msg)
Constructor for MailSendException.

Parameters:
msg - the detail message

MailSendException

public MailSendException(String msg,
                         Throwable cause)
Constructor for MailSendException.

Parameters:
msg - the detail message
cause - the root cause from the mail API in use

MailSendException

public MailSendException(Map failedMessages)
Constructor for registration of failed messages, with the messages that failed as keys, and the thrown exceptions as values.

The messages should be the same that were originally passed to the invoked send method.

Method Detail

getFailedMessages

public final Map getFailedMessages()
Return a Map with the failed messages as keys, and the thrown exceptions as values. Note that a general mail server connection failure will not result in failed messages being returned here: A message will only be contained here if actually sending it was attempted but failed.

The messages will be the same that were originally passed to the invoked send method, that is, SimpleMailMessages in case of using the generic MailSender interface.

In case of sending MimeMessage instances via JavaMailSender, the messages will be of type MimeMessage.

Returns:
the Map of failed messages as keys and thrown exceptions as values, or an empty Map if no failed messages
See Also:
SimpleMailMessage, MimeMessage

getMessage

public String getMessage()
Description copied from class: NestedRuntimeException
Return the detail message, including the message from the nested exception if there is one.

Overrides:
getMessage in class NestedRuntimeException

toString

public String toString()
Overrides:
toString in class Throwable

printStackTrace

public void printStackTrace(PrintStream ps)
Description copied from class: NestedRuntimeException
Print the composite message and the embedded stack trace to the specified stream.

Overrides:
printStackTrace in class NestedRuntimeException
Parameters:
ps - the print stream

printStackTrace

public void printStackTrace(PrintWriter pw)
Description copied from class: NestedRuntimeException
Print the composite message and the embedded stack trace to the specified writer.

Overrides:
printStackTrace in class NestedRuntimeException
Parameters:
pw - the print writer

The Spring Framework

Copyright © 2002-2007 The Spring Framework.