Example usage for javax.mail FolderNotFoundException printStackTrace

List of usage examples for javax.mail FolderNotFoundException printStackTrace

Introduction

In this page you can find the example usage for javax.mail FolderNotFoundException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.xwiki.contrib.mail.internal.AbstractMailStore.java

/**
 * {@inheritDoc}//from   w w  w . j  ava  2 s. c o  m
 * 
 * @see org.xwiki.contrib.mail.IMailReader#check(java.lang.String, boolean)
 */
@Override
public int check(String folder, boolean onlyUnread) {
    List<Message> messages = null;

    File storePath = new File(getMailSource().getLocation());
    if (!storePath.exists() || !storePath.canRead()) {
        return SourceConnectionErrors.CONNECTION_ERROR.getCode();
    }

    try {
        messages = read(folder, onlyUnread);
    } catch (FolderNotFoundException e) {
        return SourceConnectionErrors.FOLDER_NOT_FOUND.getCode();
    } catch (MessagingException e) {
        // TODO Very basic implementation of check() ...
        e.printStackTrace();
        return SourceConnectionErrors.UNEXPECTED_EXCEPTION.getCode();
    }
    return messages == null ? -1 : messages.size();
}