Author: jleroux
Date: Mon Dec 22 10:01:53 2014
New Revision: 1647275
URL:
http://svn.apache.org/r1647275Log:
A patch from Anahita Goljahani for "EntityListIterator closing issue with EntityQuery.queryCount() when using DinamicViewEntity"
https://issues.apache.org/jira/browse/OFBIZ-5921When using the queryCount() method of EntityQuery with a DinamicViewEntity, I get an error message about the EntityListIterator not being closed.
This properly closes the EntityListIterator
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java?rev=1647275&r1=1647274&r2=1647275&view=diff==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java Mon Dec 22 10:01:53 2014
@@ -423,7 +423,15 @@ public class EntityQuery {
*/
public long queryCount() throws GenericEntityException {
if (dynamicViewEntity != null) {
- return queryIterator().getResultsSizeAfterPartialList();
+ EntityListIterator iterator = null;
+ try {
+ iterator = queryIterator();
+ return iterator.getResultsSizeAfterPartialList();
+ } finally {
+ if (iterator != null) {
+ iterator.close();
+ }
+ }
}
return delegator.findCountByCondition(entityName, makeWhereCondition(false), havingEntityCondition, makeEntityFindOptions());
}