ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doo...@apache.org
Subject svn commit: r1417213 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java
Date Tue, 04 Dec 2012 21:54:50 GMT
Author: doogie
Date: Tue Dec  4 21:54:49 2012
New Revision: 1417213

URL: http://svn.apache.org/viewvc?rev=1417213&view=rev
Log:
OPTIMIZE: Now that absolute() does the correct thing for 0, fix
getPartialList() to use absolute(start - 1), instead of working around
the bug itself.

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

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java?rev=1417213&r1=1417212&r2=1417213&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java Tue Dec
 4 21:54:49 2012
@@ -467,37 +467,21 @@ public class EntityListIterator implemen
             // just in case the caller missed the 1 based thingy
             if (start == 0) start = 1;
 
-            // if starting on result 1 just call next() to avoid scrollable issues in some
databases
-            if (start == 1) {
-                if (!resultSet.next()) {
-                    return list;
-                }
-            } else {
-                // if can't reposition to desired index, throw exception
-                if (!this.absolute(start)) {
-                    // maybe better to just return an empty list here...
-                    return list;
-                    //throw new GenericEntityException("Could not move to the start position
of " + start + ", there are probably not that many results for this find.");
-                }
+            // if can't reposition to desired index, throw exception
+            if (!this.absolute(start - 1)) {
+                // maybe better to just return an empty list here...
+                return list;
+                //throw new GenericEntityException("Could not move to the start position
of " + start + ", there are probably not that many results for this find.");
             }
 
-            // get the first as the current one
-            list.add(this.currentGenericValue());
-
             GenericValue nextValue = null;
 
-            //number > 1 comparison goes first to avoid the unwanted call to next
-            while (number > 1 && (nextValue = this.next()) != null) {
+            //number > 0 comparison goes first to avoid the unwanted call to next
+            while (number > 0 && (nextValue = this.next()) != null) {
                 list.add(nextValue);
                 number--;
             }
             return list;
-        } catch (SQLException e) {
-            if (!closed) {
-                this.close();
-                Debug.logWarning("Warning: auto-closed EntityListIterator because of exception:
" + e.toString(), module);
-            }
-            throw new GeneralRuntimeException("Error getting results", e);
         } catch (GeneralRuntimeException e) {
             if (!closed) {
                 this.close();



Mime
View raw message