diff --git a/framework/src/main/groovy/org/moqui/impl/context/NotificationMessageImpl.groovy b/framework/src/main/groovy/org/moqui/impl/context/NotificationMessageImpl.groovy index 43988372d..63bc08178 100644 --- a/framework/src/main/groovy/org/moqui/impl/context/NotificationMessageImpl.groovy +++ b/framework/src/main/groovy/org/moqui/impl/context/NotificationMessageImpl.groovy @@ -96,12 +96,16 @@ class NotificationMessageImpl implements NotificationMessage, Externalizable { EntityListIterator eli = ef.find("moqui.security.UserGroupMember") .conditionDate("fromDate", "thruDate", new Timestamp(System.currentTimeMillis())) .condition("userGroupId", userGroupId).disableAuthz().iterator() - EntityValue nextValue - while ((nextValue = (EntityValue) eli.next()) != null) { - String userId = (String) nextValue.userId - if (checkedUserIds.contains(userId)) continue - checkedUserIds.add(userId) - if (checkUserNotify(userId, ef)) notifyUserIds.add(userId) + try { + EntityValue nextValue + while ((nextValue = (EntityValue) eli.next()) != null) { + String userId = (String) nextValue.userId + if (checkedUserIds.contains(userId)) continue + checkedUserIds.add(userId) + if (checkUserNotify(userId, ef)) notifyUserIds.add(userId) + } + } finally { + eli.close(); } }