/** * Return the fully qualified name of the folder, for use in log messages. * Essentially just the getURLName method, but ignoring the * MessagingException that can never happen. */ private static String folderName(Folder folder) { try { return folder.getURLName().toString(); } catch (MessagingException mex) { // can't happen return folder.getStore().toString() + "/" + folder.toString(); } } }
/** * Return the fully qualified name of the folder, for use in log messages. * Essentially just the getURLName method, but ignoring the * MessagingException that can never happen. */ private static String folderName(Folder folder) { try { return folder.getURLName().toString(); } catch (MessagingException mex) { // can't happen return folder.getStore().toString() + "/" + folder.toString(); } } }
store = session.getStore("imaps"); store.connect(mailhost, user, password); Log.i(TAG, "Store: "+store.toString()); } catch (NoSuchProviderException e) {
/** * Return the fully qualified name of the folder, for use in log messages. * Essentially just the getURLName method, but ignoring the * MessagingException that can never happen. */ private static String folderName(Folder folder) { try { return folder.getURLName().toString(); } catch (MessagingException mex) { // can't happen return folder.getStore().toString() + "/" + folder.toString(); } } }
/** * Return the fully qualified name of the folder, for use in log messages. * Essentially just the getURLName method, but ignoring the * MessagingException that can never happen. */ private static String folderName(Folder folder) { try { return folder.getURLName().toString(); } catch (MessagingException mex) { // can't happen return folder.getStore().toString() + "/" + folder.toString(); } } }
/** * Return the fully qualified name of the folder, for use in log messages. * Essentially just the getURLName method, but ignoring the * MessagingException that can never happen. */ private static String folderName(Folder folder) { try { return folder.getURLName().toString(); } catch (MessagingException mex) { // can't happen return folder.getStore().toString() + "/" + folder.toString(); } } }
/** * Close connection * <b>Note</b>Internal method * @throws MessagingException */ public void closeStoreConnection( boolean storeConnected ) throws MessagingException { if (storeConnected) { // the folder is empty when the message is not loaded from IMAP server, but from a file Folder imapFolder = message.getFolder(); if (imapFolder == null) { imapFolder = partOfImapFolder; // in case of nested package but still originating from IMAP server } if (imapFolder != null) { Store store = imapFolder.getStore(); if (store != null && store.isConnected()) { // closing store closes and its folders log.debug("Closing store (" + store.toString() + ") and associated folders"); store.close(); } } } }
/** * Return the fully qualified name of the folder, for use in log messages. * Essentially just the getURLName method, but ignoring the * MessagingException that can never happen. */ private static String folderName(Folder folder) { try { return folder.getURLName().toString(); } catch (MessagingException mex) { // can't happen return folder.getStore().toString() + "/" + folder.toString(); } } }
this.log.log(Level.WARNING, "Error closing mail Store : " + store.toString(), ex);
/** * Retrieve a specified {@link Folder} from the given {@link Store} and open it. * * @param store * the mail {@link Store} * @param consumeDescriptor * the mail {@link ConsumeDescriptor} * @return the opened {@link Folder} * @throws MessagingException */ public Folder getFolderAndOpen(Store store, ConsumeDescriptor consumeDescriptor) throws MessagingException { String msg = ""; // Search in the specified folder of this Store Folder folder = null; folder = store.getDefaultFolder(); if (folder == null) { msg = "No default folder for this store : " + store.toString(); throw new MessagingException(msg); } folder = folder.getFolder(consumeDescriptor.getFolder()); if (folder == null) { msg = "Invalid folder : " + consumeDescriptor.getFolder(); throw new MessagingException(msg); } folder.open(Folder.READ_WRITE); return folder; }