From 5b311d6be2a52543a16d45139bd8a4e991cbb883 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Wed, 8 Nov 2017 09:17:41 +0000 Subject: [PATCH] Fixed: EntityListIterator.getComplateList returns error randomly (OFBIZ-9919) Using a dynamic view entity containing groupBy clause and after calling getCompleteList method, I am getting an error and it got fixed when I removed that ArrayList sizing. IMO, it might be occurring due to improper size initialization and I see no reason for this and it is handled in ArrayList dynamically. jleroux: moreover there is not much gain for cases where the pre-allocation makes sense Thanks: Suraj Khurana git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1814561 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/ofbiz/entity/util/EntityListIterator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityListIterator.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityListIterator.java index ea4e53ae5b..8ba5f082ce 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityListIterator.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityListIterator.java @@ -414,7 +414,7 @@ public class EntityListIterator implements AutoCloseable, ListIterator list = new ArrayList<>((int) this.getResultSize()); + List list = new ArrayList<>(); GenericValue nextValue; while ((nextValue = this.next()) != null) { @@ -457,7 +457,7 @@ public class EntityListIterator implements AutoCloseable, ListIterator(0); } - List list = new ArrayList<>(this.getResultsSizeAfterPartialList()); + List list = new ArrayList<>(); GenericValue nextValue = null; // number > 0 comparison goes first to avoid the unwanted call to next while (number > 0 && (nextValue = this.next()) != null) {