List of usage examples for javax.mail FolderNotFoundException FolderNotFoundException
public FolderNotFoundException()
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); } }