From 842e1b21cd27bd248cd0997d6f52d6fc5c69d852 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Thu, 1 Jun 2017 08:18:48 +0000 Subject: [PATCH] No functional changes. Replaces entityListIterator.close() in finally by try-with-ressource This is a weirdo badly written double case but with some refactoring I can confirm it works at https://localhost:8443/facility/control/ViewFacilityInventoryByProduct which uses the getProductInventoryAndFacilitySummary service git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1797161 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/ofbiz/entity/util/EntityQuery.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java index 6762115dae..e4cfce26d5 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java @@ -428,14 +428,8 @@ public class EntityQuery { */ public long queryCount() throws GenericEntityException { if (dynamicViewEntity != null) { - EntityListIterator iterator = null; - try { - iterator = queryIterator(); + try (EntityListIterator iterator = queryIterator()) { return iterator.getResultsSizeAfterPartialList(); - } finally { - if (iterator != null) { - iterator.close(); - } } } return delegator.findCountByCondition(entityName, makeWhereCondition(false), havingEntityCondition, makeEntityFindOptions());