You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2015/01/16 09:34:50 UTC

svn commit: r1652361 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java

Author: jacopoc
Date: Fri Jan 16 08:34:49 2015
New Revision: 1652361

URL: http://svn.apache.org/r1652361
Log:
Modified code to make sure the EntityListIterator is always closed after being used.
Thanks to Deepak Dixit and Nameet Jain for spotting the issue and identifying the offending code.


Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=1652361&r1=1652360&r2=1652361&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Fri Jan 16 08:34:49 2015
@@ -1805,10 +1805,18 @@ public class GenericDelegator implements
                 beganTransaction = TransactionUtil.begin();
             }
 
-            EntityListIterator eli = this.find(entityName, entityCondition, null, fieldsToSelect, orderBy, findOptions);
-            eli.setDelegator(this);
-            List<GenericValue> list = eli.getCompleteList();
-            eli.close();
+            EntityListIterator eli = null;
+            List<GenericValue> list = null;
+            try {
+                eli = this.find(entityName, entityCondition, null, fieldsToSelect, orderBy, findOptions);
+                list = eli.getCompleteList();
+            } finally {
+                if (eli != null) {
+                    try {
+                        eli.close();
+                    } catch (Exception exc) {}
+                }
+            }
 
             if (useCache) {
                 ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_PUT, EntityEcaHandler.OP_FIND, dummyValue, false);