svn commit: r1641548 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1641548 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java

jleroux@apache.org
Author: jleroux
Date: Tue Nov 25 09:14:36 2014
New Revision: 1641548

URL: http://svn.apache.org/r1641548
Log:
A patch from  Deepak Dixit for "EntityListIterator Not Closed for Entity JobSandbox, caught in Finalize" https://issues.apache.org/jira/browse/OFBIZ-5885

EntityListIterator Not Closed for Entity JobSandbox in ServiceUtil.purgeOldJobs method. Need to close the entity list iterator properly.

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java?rev=1641548&r1=1641547&r2=1641548&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java Tue Nov 25 09:14:36 2014
@@ -424,11 +424,14 @@ public class ServiceUtil {
                     // begin this transaction
                     beganTx1 = TransactionUtil.begin();
 
-                    EntityListIterator foundJobs = delegator.find("JobSandbox", mainCond, null, UtilMisc.toSet("jobId"), null, findOptions);
+                    EntityListIterator foundJobs = null;
                     try {
+                        foundJobs = delegator.find("JobSandbox", mainCond, null, UtilMisc.toSet("jobId"), null, findOptions);
                         curList = foundJobs.getPartialList(1, 1000);
                     } finally {
-                        foundJobs.close();
+                        if (foundJobs != null) {
+                            foundJobs.close();
+                         }
                     }
                 } catch (GenericEntityException e) {
                     Debug.logError(e, "Cannot obtain job data from datasource", module);