Author: jleroux
Date: Thu Jun 1 13:23:40 2017 New Revision: 1797222 URL: http://svn.apache.org/viewvc?rev=1797222&view=rev Log: No functional changes. Replaces entityListIterator.close() in finally by try-with-ressource Modified: ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java Modified: ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java?rev=1797222&r1=1797221&r2=1797222&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java Thu Jun 1 13:23:40 2017 @@ -1151,21 +1151,12 @@ public class CommunicationEventServices inputFields.put("infoString_ic", caseInsensitiveEmail); result = dispatcher.runSync("performFind", UtilMisc.<String, Object>toMap("entityName", "WorkEffortContactMechView" ,"inputFields", inputFields, "userLogin", userLogin)); - EntityListIterator listIt = (EntityListIterator) result.get("listIt"); - - try { + try (EntityListIterator listIt = (EntityListIterator) result.get("listIt")) { List<GenericValue> list = listIt.getCompleteList(); List<GenericValue> filteredList = EntityUtil.filterByDate(list); tempResults.addAll(filteredList); } catch (GenericEntityException e) { Debug.logError(e, module); - } finally { - try { - listIt.close(); - } catch (GenericEntityException e) { - Debug.logError(e, module); - } - } } } } Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java?rev=1797222&r1=1797221&r2=1797222&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java Thu Jun 1 13:23:40 2017 @@ -42,20 +42,11 @@ public class PerformFindTests extends OF } private List<GenericValue> getCompleteList(Map<String, Object> context) { - EntityListIterator listIt = (EntityListIterator) context.get("listIt"); List<GenericValue> foundElements = new LinkedList<GenericValue>(); - if (listIt != null) { - try { + try (EntityListIterator listIt = (EntityListIterator) context.get("listIt")) { foundElements = listIt.getCompleteList(); } catch (GenericEntityException e) { Debug.logError(" Failed to extract values from EntityListIterator after a performFind service", module); - } finally { - try { - listIt.close(); - } catch (GenericEntityException e) { - Debug.logError(" Failed to close EntityListIterator after a performFind service", module); - } - } } return foundElements; } |
Free forum by Nabble | Edit this page |