From 8aa93193b8a2729fb00a41a74158f73da9b2631c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=A9=20Strysewske?= Date: Wed, 4 Oct 2017 09:40:59 +0200 Subject: [PATCH] #353 - Fixed server crashing when trying to log in as an Admin --- .../de/symeda/sormas/backend/caze/CaseService.java | 2 ++ .../sormas/backend/contact/ContactService.java | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseService.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseService.java index 3e9b1786def..23f9a6a5f81 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseService.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseService.java @@ -163,6 +163,8 @@ public Predicate createUserFilter(CriteriaBuilder cb, CriteriaQuery cq, From getMapContacts(Date fromDate, Date toDate, Disease disease, if (toDate != null) { dateFilter = cb.and(dateFilter, cb.lessThanOrEqualTo(from.get(Contact.REPORT_DATE_TIME), toDate)); } - filter = cb.and(filter, dateFilter); + if (filter != null) { + filter = cb.and(filter, dateFilter); + } else { + filter = dateFilter; + } } if (disease != null) { Join contactCase = from.join(Contact.CAZE); @@ -129,7 +133,11 @@ public List getMapContacts(Date fromDate, Date toDate, Disease disease, filter = cb.and(filter, diseaseFilter); } // Only retrieve contacts that are currently under follow-up - filter = cb.and(filter, cb.equal(from.get(Contact.FOLLOW_UP_STATUS), FollowUpStatus.FOLLOW_UP)); + if (filter != null) { + filter = cb.and(filter, cb.equal(from.get(Contact.FOLLOW_UP_STATUS), FollowUpStatus.FOLLOW_UP)); + } else { + filter = cb.equal(from.get(Contact.FOLLOW_UP_STATUS), FollowUpStatus.FOLLOW_UP); + } cq.where(filter); return em.createQuery(cq).getResultList(); }