public void closeFolders() { Collection<BackupFolder> folders = openFolders.values(); for (BackupFolder folder : folders) { try { folder.close(); } catch (Exception e) { Log.w(TAG, e); } } openFolders.clear(); }
private @NotNull BackupFolder createAndOpenFolder(DataType type, @NotNull String label) throws MessagingException { try { BackupFolder folder = new BackupFolder(this, label, type); if (!folder.exists()) { Log.i(TAG, "Label '" + label + "' does not exist yet. Creating."); folder.create(FolderType.HOLDS_MESSAGES); } folder.open(OpenMode.READ_WRITE); return folder; } catch (IllegalArgumentException e) { // thrown inside K9 Log.e(TAG, "K9 error", e); throw new MessagingException(e.getMessage()); } }
private BackupFolder getBackupFolder(String label) throws MessagingException { if (label == null) throw new IllegalStateException("label is null"); try { BackupFolder folder = new BackupFolder(this, label); if (!folder.exists()) { folder.create(FolderType.HOLDS_MESSAGES); Log.i(TAG, "Label '" + label + "' does not exist yet. Creating."); } folder.open(OpenMode.READ_WRITE); return folder; } catch (java.lang.NumberFormatException e) { // thrown inside K9 Log.e(TAG, "K9 error", e); throw new MessagingException(e.getMessage()); } }
public BackupFolder getFolder(DataType type) throws MessagingException { String label = type.getFolder(context); if (label == null) throw new IllegalStateException("label is null"); try { final BackupFolder folder = new BackupFolder(this, label, type); if (!folder.exists()) { folder.create(FolderType.HOLDS_MESSAGES); Log.i(TAG, "Label '" + label + "' does not exist yet. Creating."); } folder.open(OpenMode.READ_WRITE); return folder; } catch (IllegalArgumentException e) { // thrown inside K9 Log.e(TAG, "K9 error", e); throw new MessagingException(e.getMessage()); } }