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
This commit is contained in:
Jacques Le Roux
2017-11-08 09:17:41 +00:00
parent 3894a59045
commit 5b311d6be2
@@ -414,7 +414,7 @@ public class EntityListIterator implements AutoCloseable, ListIterator<GenericVa
// do a quick check to see if the ResultSet is empty
resultSet.beforeFirst();
}
List<GenericValue> list = new ArrayList<>((int) this.getResultSize());
List<GenericValue> list = new ArrayList<>();
GenericValue nextValue;
while ((nextValue = this.next()) != null) {
@@ -457,7 +457,7 @@ public class EntityListIterator implements AutoCloseable, ListIterator<GenericVa
return new ArrayList<>(0);
}
List<GenericValue> list = new ArrayList<>(this.getResultsSizeAfterPartialList());
List<GenericValue> 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) {