From 746d85c12a513808a6993eec12865ed774c13a26 Mon Sep 17 00:00:00 2001 From: Yao Chunlin Date: Wed, 29 Nov 2023 12:33:17 +0800 Subject: [PATCH] BugFix EntityListIterator not closed in NotificationMessageImpl#getNotifyUserIds --- .../impl/context/NotificationMessageImpl.groovy | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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(); } }