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

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

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

jleroux@apache.org
Author: jleroux
Date: Wed Nov  8 09:17:41 2017
New Revision: 1814561

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

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

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityListIterator.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityListIterator.java?rev=1814561&r1=1814560&r2=1814561&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityListIterator.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityListIterator.java Wed Nov  8 09:17:41 2017
@@ -414,7 +414,7 @@ public class EntityListIterator implemen
                 // 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 implemen
                 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) {