svn commit: r1797161 - /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java

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

svn commit: r1797161 - /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java

jleroux@apache.org
Author: jleroux
Date: Thu Jun  1 08:18:48 2017
New Revision: 1797161

URL: http://svn.apache.org/viewvc?rev=1797161&view=rev
Log:
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

Modified:
    ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java?rev=1797161&r1=1797160&r2=1797161&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java Thu Jun  1 08:18:48 2017
@@ -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());