コード例 #1
0
ファイル: FolderTableModel.java プロジェクト: zieglerm/enh
  public void setFolder(Folder newFolder) throws MessagingException {
    if (folder != null) {
      try {
        folder.removeMessageCountListener(messageCountListener);
        folder.close(true);
      } catch (Exception ex) {
        // Failure here seems to happen relatively often.
        // enp has a corrupt folder, for example, and enh finds that Exchange seems to sometimes
        // close folders on him, maybe because he's running Outlook at the same time.
        // It's not currently obvious that there's much to be gained by showing this error to the
        // user.
        // It does seem that we should blunder on, rather than back out, because the UI's already
        // been updated by this point.
        // If we back out here, we really need to back out the UI change too, and going that route
        // seems like a mistake.
        ex.printStackTrace();
      }
    }

    this.folder = newFolder;
    this.messages = Collections.<Message>emptyList();

    if (folder != null) {
      scanWholeFolder();
      folder.addMessageChangedListener(messageChangedListener);
      folder.addMessageCountListener(messageCountListener);
    }
  }
コード例 #2
0
 @Override
 protected void doStop() {
   synchronized (folderLock) {
     if (folder != null) {
       folder.removeMessageCountListener(this);
     }
   }
 }
コード例 #3
0
 @Override
 protected void doDispose() {
   synchronized (folderLock) {
     if (null != folder) {
       folder.removeMessageCountListener(this);
       if (folder.isOpen()) {
         try {
           folder.close(true);
         } catch (Exception e) {
           logger.debug("ignoring exception: " + e.getMessage(), e);
         }
       }
     }
   }
 }