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
This commit is contained in:
Jacques Le Roux
2017-06-08 16:16:29 +00:00
parent c7bda90601
commit d9a24d5a34
@@ -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);