From d9a24d5a347e28f241e73af9c4d9ea4bb55aeb16 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Thu, 8 Jun 2017 16:16:29 +0000 Subject: [PATCH] This fixes a bug introduced with r1797097 As noted in code the EntityListIterator was not closed for a "good" reason: it might be used later by the framework though not passed as a var. I think I found 1 case where it's closed after the returned list have been used (in EntityAnd.getChildren() in ModelTree.java); but I have to check the whole thing git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1798086 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/ofbiz/entity/finder/ListFinder.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java index 9e6625ddf8..1b1a379a19 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java @@ -207,11 +207,13 @@ public abstract class ListFinder extends Finder { options.setMaxRows(size * (index + 1)); } boolean beganTransaction = false; - try (EntityListIterator eli = delegator.find(entityName, whereEntityCondition, havingEntityCondition, fieldsToSelect, orderByFields, options)) { + try { if (useTransaction) { beganTransaction = TransactionUtil.begin(); } + EntityListIterator eli = delegator.find(entityName, whereEntityCondition, havingEntityCondition, fieldsToSelect, orderByFields, options); this.outputHandler.handleOutput(eli, context, listAcsr); + // NOTE: the eli EntityListIterator is not closed here. It SHOULD be closed later after the returned list will be used (eg see EntityAnd.getChildren() in ModelTree.java) } catch (GenericEntityException e) { String errMsg = "Failure in by " + label + " find operation, rolling back transaction"; Debug.logError(e, errMsg, module);