Example usage for javax.mail FolderNotFoundException FolderNotFoundException

List of usage examples for javax.mail FolderNotFoundException FolderNotFoundException

Introduction

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

Prototype

public FolderNotFoundException() 

Source Link

Document

Constructs a FolderNotFoundException with no detail message.

Usage

From source file:org.sourceforge.net.javamail4ews.store.EwsFolder.java

@Override
public void open(int mode) throws MessagingException {
    this.mode = mode;
    try {//ww w.j a  v  a2  s  .  c o  m
        if (!exists()) {
            throw new FolderNotFoundException();
        }
        ItemView view = new ItemView(ITEM_VIEW_MAX_ITEMS);
        folder = Folder.bind(getService(), folder.getId());

        if (prefetchItems) {
            FindItemsResults<Item> lFindResults = getService().findItems(folder.getId(), view);
            messages = new ArrayList<>(lFindResults.getTotalCount());
            unreadMessages = new ArrayList<>();
            for (Item aItem : lFindResults) {
                if (aItem instanceof EmailMessage) {
                    logger.info("Fetching content of item {}", aItem.getId());

                    EmailMessage aEmailMessage = (EmailMessage) aItem;

                    EwsMailConverter aConverter = new EwsMailConverter(this, aEmailMessage,
                            messages.size() + 1);

                    messages.add(aConverter.convert());

                } else {
                    logger.warn("Skipping item {} as it is a {}", aItem.getId(), aItem.getClass());
                }
            }
        } else {

        }
        timestamp = new Date();
        getStore().notifyConnectionListeners(ConnectionEvent.OPENED);
    } catch (Exception e) {
        throw new MessagingException(e.getMessage(), e);
    }
}