diff --git a/framework/service/src/org/ofbiz/service/ServiceUtil.java b/framework/service/src/org/ofbiz/service/ServiceUtil.java index 3a046e2613..4fab7c2dfc 100644 --- a/framework/service/src/org/ofbiz/service/ServiceUtil.java +++ b/framework/service/src/org/ofbiz/service/ServiceUtil.java @@ -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);