Get the number of new messages in this Folder. This method can be invoked on a closed folder. However, note that for some folder implementations, getting the new message count can be an expensive operation involving actually opening the folder. In such cases, a provider can choose not to suppor
()
| 733 | * @exception MessagingException for other failures |
| 734 | */ |
| 735 | public synchronized int getNewMessageCount() |
| 736 | throws MessagingException { |
| 737 | if (!isOpen()) |
| 738 | return -1; |
| 739 | |
| 740 | int newmsgs = 0; |
| 741 | int total = getMessageCount(); |
| 742 | for (int i = 1; i <= total; i++) { |
| 743 | try { |
| 744 | if (getMessage(i).isSet(Flags.Flag.RECENT)) |
| 745 | newmsgs++; |
| 746 | } catch (MessageRemovedException me) { |
| 747 | // This is an expunged message, ignore it. |
| 748 | continue; |
| 749 | } |
| 750 | } |
| 751 | return newmsgs; |
| 752 | } |
| 753 | |
| 754 | /** |
| 755 | * Get the total number of unread messages in this Folder. <p> |
nothing calls this directly
no test coverage detected