You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2013/01/28 18:59:00 UTC

svn commit: r1439530 - /lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/AppendingLongBuffer.java

Author: jpountz
Date: Mon Jan 28 17:58:59 2013
New Revision: 1439530

URL: http://svn.apache.org/viewvc?rev=1439530&view=rev
Log:
Fix AppendingLongBuffer/Iterator.hasNext.

This method failed to return the right result when the total number of values was a multiple of MAX_PENDING_COUNT = 1024.

Modified:
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/AppendingLongBuffer.java

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/AppendingLongBuffer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/AppendingLongBuffer.java?rev=1439530&r1=1439529&r2=1439530&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/AppendingLongBuffer.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/AppendingLongBuffer.java Mon Jan 28 17:58:59 2013
@@ -124,7 +124,7 @@ public class AppendingLongBuffer {
       } else if (values[vOff] == null) {
         Arrays.fill(currentValues, minValues[vOff]);
       } else {
-        for (int k = 0; k < MAX_PENDING_COUNT; ++k) {
+        for (int k = 0; k < MAX_PENDING_COUNT; ) {
           k += values[vOff].get(k, currentValues, k, MAX_PENDING_COUNT - k);
         }
         for (int k = 0; k < MAX_PENDING_COUNT; ++k) {
@@ -135,7 +135,7 @@ public class AppendingLongBuffer {
 
     /** Whether or not there are remaining values. */
     public boolean hasNext() {
-      return vOff < valuesOff || pOff < pendingOff;
+      return vOff < valuesOff || (vOff == valuesOff && pOff < pendingOff);
     }
 
     /** Return the next long in the buffer. */