本文整理汇总了Java中javax.mail.MessagingException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java MessagingException.getMessage方法的具体用法?Java MessagingException.getMessage怎么用?Java MessagingException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.mail.MessagingException
的用法示例。
在下文中一共展示了MessagingException.getMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SubethaEmailMessagePart
import javax.mail.MessagingException; //导入方法依赖的package包/类
/**
* Object can be built on existing message part only.
*
* @param messagePart Message part.
*/
public SubethaEmailMessagePart(Part messagePart)
{
ParameterCheck.mandatory("messagePart", messagePart);
try
{
fileSize = messagePart.getSize();
fileName = messagePart.getFileName();
contentType = messagePart.getContentType();
Matcher matcher = encodingExtractor.matcher(contentType);
if (matcher.find())
{
encoding = matcher.group(1);
if (!Charset.isSupported(encoding))
{
throw new EmailMessageException(ERR_UNSUPPORTED_ENCODING, encoding);
}
}
try
{
contentInputStream = messagePart.getInputStream();
}
catch (Exception ex)
{
throw new EmailMessageException(ERR_FAILED_TO_READ_CONTENT_STREAM, ex.getMessage());
}
}
catch (MessagingException e)
{
throw new EmailMessageException(ERR_INCORRECT_MESSAGE_PART, e.getMessage());
}
}
示例2: getAttributes
import javax.mail.MessagingException; //导入方法依赖的package包/类
public MailMessageAttributes getAttributes() throws FolderException {
if (attributes == null) {
attributes = new SimpleMessageAttributes();
try {
attributes.setAttributesFor(mimeMessage);
} catch (MessagingException e) {
throw new FolderException("Could not parse mime message." + e.getMessage());
}
}
return attributes;
}
示例3: pageInRowIndex
import javax.mail.MessagingException; //导入方法依赖的package包/类
/**
* Pages in a row index, making sure that it (and all other
* messages in its block) are available.
*/
public void pageInRowIndex(int index)
{
if (_loaded[index] == null)
{
try
{
if (_LOG.isLoggable(Level.FINEST))
{
_LOG.finest("total messages before open:"+_folder.getMessageCount());
}
_folder.open(Folder.READ_ONLY);
// after the folder is opened, the count may change:
_count = _folder.getMessageCount();
// Calculate "from" and "to", zero-indexed
// Round down to the start of the block
int fromIndex = (index / _blockSize) * _blockSize;
int toIndex = fromIndex + _blockSize - 1;
if (toIndex >= _count)
toIndex = _count - 1;
try
{
// Retrieve the messages from the one-indexed Javamail API
int jmFromIndex = _getFlippedIndex(toIndex) + 1;
int jmToIndex = _getFlippedIndex(fromIndex) + 1;
if (_LOG.isLoggable(Level.FINEST))
_LOG.finest("fetching messages from:"+jmFromIndex+
" to:"+jmToIndex+
" total:"+ getRowCount() +
" actual total:"+_folder.getMessageCount());
Message[] messages = _folder.getMessages(
jmFromIndex,
jmToIndex);
_folder.fetch(messages, _fetchProfile);
for (int i = 0; i < messages.length; i++)
{
Message message = messages[messages.length - i - 1];
_loaded[i + fromIndex] = new MessageData(message);
}
}
finally
{
_folder.close(false);
}
}
// This is poor; for starters, the page is likely
// already displaying, so it's too late to show an error message.
// We should try paging in rows up front via a RangeChangeListener to
// catch the earlier and provide useful errors.
catch (MessagingException me)
{
_LOG.log(Level.SEVERE, me.getMessage(), me);
FacesMessage errorMessage = new FacesMessage(
FacesMessage.SEVERITY_ERROR,
me.getMessage(),
me.getStackTrace().toString());
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, errorMessage);
}
}
}