Example #1
0
  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());
    }
  }