Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit dfad8e6

Browse files
author
Rustam Aliyev
committed
Fix NPE condition. Update notification regex rules.
1 parent 067225e commit dfad8e6

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

modules/core/src/main/java/com/elasticinbox/core/cassandra/CassandraLabelDAO.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,14 @@ public LabelMap getAllWithMetadata(final Mailbox mailbox)
8484

8585
for (int labelId : counters.keySet())
8686
{
87-
labels.get(labelId).setCounters(counters.get(labelId));
87+
if (labels.containsId(labelId) && counters.containsKey(labelId)) {
88+
labels.get(labelId).setCounters(counters.get(labelId));
89+
} else if (labels.containsId(labelId) && !counters.containsKey(labelId)) {
90+
// assume zeros for all counters if not yet initialised
91+
labels.get(labelId).setCounters(new LabelCounters());
92+
} else if (!labels.containsId(labelId) && counters.containsKey(labelId)) {
93+
logger.warn("Found counters for label {}, but label does not exist.", labelId);
94+
}
8895
}
8996

9097
return labels;

modules/lmtp/src/main/java/com/elasticinbox/lmtp/filter/NotificationMailFilter.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,18 @@ public Message filter(Message message)
5656
|| from.matches("(.+)\\@pages\\.facebookmail\\.com")
5757
|| from.matches("bezotveta\\@odnoklassniki\\.ru")
5858
|| from.matches("admin\\@vkontakte\\.ru")
59-
|| from.matches("(.+)\\-(.+)\\@postmaster\\.twitter\\.com")
59+
|| from.matches("admin\\@notify\\.vk\\.com")
60+
|| from.matches("(.+)\\@postmaster\\.twitter\\.com")
61+
|| from.matches("(.+)\\@bounce\\.twitter\\.com")
62+
|| from.matches("info\\@twitter\\.com")
63+
|| from.matches("notify\\@twitter\\.com")
64+
|| from.matches("(.+)\\@email\\.foursquare\\.com")
65+
|| from.matches("(.+)\\@email\\.pinterest\\.com")
6066
|| from.matches("(.+)\\@bounce\\.linkedin\\.com")
6167
|| from.matches("(.+)\\@linkedin\\.com")
6268
|| from.matches("noreply\\-(.+)\\@plus\\.google\\.com")
69+
|| from.matches("notifications\\@meetmemail\\.com")
70+
|| from.matches("notification\\+(.+)\\@netlogmail\\.com")
6371
|| from.matches("notifications\\+(.+)\\@zyngamail\\.com"))
6472
{
6573
logger.debug("Applying filter for NOTIFICATIONS");

0 commit comments

Comments
 (0)