Author: jleroux
Date: Thu Jun  8 16:16:29 2017
New Revision: 1798086

URL: http://svn.apache.org/viewvc?rev=1798086&view=rev
Log:
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

Modified:
    
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java

Modified: 
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java?rev=1798086&r1=1798085&r2=1798086&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java
 Thu Jun  8 16:16:29 2017
@@ -207,11 +207,13 @@ public abstract class ListFinder extends
                     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);


Reply via email to