svn commit: r1798388 - /ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java

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

svn commit: r1798388 - /ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java

jleroux@apache.org
Author: jleroux
Date: Sun Jun 11 17:30:26 2017
New Revision: 1798388

URL: http://svn.apache.org/viewvc?rev=1798388&view=rev
Log:
No functional change, this is better than r1798060

Modified:
    ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java

Modified: ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=1798388&r1=1798387&r2=1798388&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java Sun Jun 11 17:30:26 2017
@@ -1053,9 +1053,8 @@ public class WorkEffortServices {
 
     public static Map<String, Object> removeDuplicateWorkEfforts(DispatchContext ctx, Map<String, ? extends Object> context) {
         List<GenericValue> resultList = null;
-        EntityListIterator eli = (EntityListIterator) context.get("workEffortIterator");
-        if (eli != null) {
-            try {
+        try (EntityListIterator eli = (EntityListIterator) context.get("workEffortIterator")) {
+            if (eli != null) {
                 Set<String> keys = new HashSet<String>();
                 resultList = new LinkedList<GenericValue>();
                 GenericValue workEffort = eli.next();
@@ -1067,20 +1066,14 @@ public class WorkEffortServices {
                     }
                     workEffort = eli.next();
                 }
-            } catch (Exception e) {
-                Debug.logError(e, module);
-            } finally {
-                try {
-                    eli.close();
-                } catch (GenericEntityException e) {
-                    Debug.logError(e, "Error while closing EntityListIterator: ", module);
+            } else {
+                List<GenericValue> workEfforts = UtilGenerics.checkList(context.get("workEfforts"));
+                if (workEfforts != null) {
+                    resultList = WorkEffortWorker.removeDuplicateWorkEfforts(workEfforts);
                 }
             }
-        } else {
-            List<GenericValue> workEfforts = UtilGenerics.checkList(context.get("workEfforts"));
-            if (workEfforts != null) {
-                resultList = WorkEffortWorker.removeDuplicateWorkEfforts(workEfforts);
-            }
+        } catch (Exception e) {
+            Debug.logError(e, module);
         }
         Map<String, Object> result = ServiceUtil.returnSuccess();
         result.put("workEfforts", resultList);