/** * Delete this folder. */ public synchronized boolean delete(boolean recurse) throws MessagingException { checkClosed(); // insure that this folder is closed. if (recurse) { // Delete all subfolders. Folder[] f = list(); for (int i = 0; i < f.length; i++) f[i].delete(recurse); // ignore intermediate failures } // Attempt to delete this folder Object ret = doCommandIgnoreFailure(new ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException { p.delete(fullName); return Boolean.TRUE; } }); if (ret == null) // Non-existent folder/No permission ?? return false; // DELETE succeeded. exists = false; attributes = null; // Notify listeners on self and our Store notifyFolderListeners(FolderEvent.DELETED); return true; }
f[i].delete(recurse); // ignore intermediate failures
/** * {@inheritDoc} */ public Boolean call() throws Exception { return folder.delete(recurse); } }
@Override public boolean delete(boolean recurse) throws RuntimeMessagingException { try { return delegate.delete(recurse); } catch (MessagingException e) { throw new RuntimeMessagingException(e); } }
public void delete(String folderName) throws Exception { WithContext<Object> action = ctx -> { Folder folder = ctx.store.getFolder(folderName); if (folder.exists()) { folder.delete(true); } folder.close(true); return null; }; performWithContext(action); }
/** * Delete this folder. */ public synchronized boolean delete(boolean recurse) throws MessagingException { checkClosed(); // insure that this folder is closed. if (recurse) { // Delete all subfolders. Folder[] f = list(); for (int i = 0; i < f.length; i++) f[i].delete(recurse); // ignore intermediate failures } // Attempt to delete this folder Object ret = doCommandIgnoreFailure(new ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException { p.delete(fullName); return Boolean.TRUE; } }); if (ret == null) // Non-existent folder/No permission ?? return false; // DELETE succeeded. exists = false; attributes = null; // Notify listeners on self and our Store notifyFolderListeners(FolderEvent.DELETED); return true; }
/** * Delete this folder. */ public synchronized boolean delete(boolean recurse) throws MessagingException { checkClosed(); // insure that this folder is closed. if (recurse) { // Delete all subfolders. Folder[] f = list(); for (int i = 0; i < f.length; i++) f[i].delete(recurse); // ignore intermediate failures } // Attempt to delete this folder Object ret = doCommandIgnoreFailure(new ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException { p.delete(fullName); return Boolean.TRUE; } }); if (ret == null) // Non-existent folder/No permission ?? return false; // DELETE succeeded. exists = false; attributes = null; // Notify listeners on self and our Store notifyFolderListeners(FolderEvent.DELETED); return true; }
f[i].delete(recurse); // ignore intermediate failures
f[i].delete(recurse); // ignore intermediate failures
f[i].delete(recurse); // ignore intermediate failures
f[i].delete(recurse); // ignore intermediate failures
@Override protected GenericResult executeInternal(DeleteFolder action, ExecutionContext context) throws ActionException { User user = getUser(); IMAPFolder folder = action.getFolder(); try { IMAPStore store = cache.get(user); Folder f = store.getFolder(folder.getFullName()); // close the folder if its open if (f.isOpen()) { f.close(false); } // recursive delete the folder if (f.delete(true)) { logger.info("Successfully delete folder " + folder + " for user " + user); return new GenericResult(); } else { throw new ActionException("Unable to delete folder " + folder + " for user " + user); } } catch (Exception e) { logger.error("Error while deleting folder " + folder + " for user " + user,e); throw new ActionException("Error while deleting folder " + folder + " for user " + user,e); } }
@Override public void removeFolder(String folderName) { connect(); try { @SuppressWarnings("resource") // reason: folder is explicitly closed if it is open and deleted afterwards Folder folder = findFolder(folderName); if (folder != null && folder.exists()) { if (folder.isOpen()) { folder.close(true); } folder.delete(true); } } catch (MessagingException e) { throw new ProcessingException(e.getMessage(), e); } }
for (int i = 0; i < subfolders.length; i++) { subfolders[i].delete(true);