From abf47d3a6f41ae80ad4114a4d6532718bfb1af3e Mon Sep 17 00:00:00 2001 From: André Abreu Date: Mon, 29 Jun 2020 18:45:22 +0100 Subject: Fix multiple alarms types comparison (#4552) * Fix multiple alarms types comparison * renamed `alarmsStr` to `alarmsAttribute` * always filter when `alarmsAttribute` is null --- src/main/java/org/traccar/database/NotificationManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/traccar/database/NotificationManager.java b/src/main/java/org/traccar/database/NotificationManager.java index 09df4c571..7d2a1bb2e 100644 --- a/src/main/java/org/traccar/database/NotificationManager.java +++ b/src/main/java/org/traccar/database/NotificationManager.java @@ -92,9 +92,12 @@ public class NotificationManager extends ExtendedObjectManager { if (getById(notificationId).getType().equals(event.getType())) { boolean filter = false; if (event.getType().equals(Event.TYPE_ALARM)) { - String alarms = notification.getString("alarms"); - if (alarms == null || !alarms.contains(event.getString(Position.KEY_ALARM))) { + String alarmsAttribute = notification.getString("alarms"); + if (alarmsAttribute == null) { filter = true; + } else { + List alarms = Arrays.asList(alarmsAttribute.split(",")); + filter = !alarms.contains(event.getString(Position.KEY_ALARM)); } } if (!filter) { -- cgit v1.2.3