diff --git a/lucene/src/java/org/apache/lucene/index/TermsEnum.java b/lucene/src/java/org/apache/lucene/index/TermsEnum.java index d96ec0dc937..982b31d23ca 100644 --- a/lucene/src/java/org/apache/lucene/index/TermsEnum.java +++ b/lucene/src/java/org/apache/lucene/index/TermsEnum.java @@ -117,7 +117,9 @@ public abstract class TermsEnum { /** Increments the enumeration to the next term. * Returns the resulting term, or null if the end was * hit (which means the enum is unpositioned). The - * returned BytesRef may be re-used across calls to next. */ + * returned BytesRef may be re-used across calls to next. + * After this method returns null, do not call it again: + * the results are undefined. */ public abstract BytesRef next() throws IOException; /** Returns current term. Do not call this when the enum diff --git a/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java b/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java index 3104d450472..f014631ce10 100644 --- a/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java +++ b/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java @@ -408,7 +408,8 @@ public class TestNumericRangeQuery32 extends LuceneTestCase { } last = new BytesRef(cur); } - assertNull(termEnum.next()); + // LUCENE-3314: the results after next() already returned null are undefined, + // assertNull(termEnum.next()); return count; } diff --git a/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java b/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java index 8fb0851d252..9d790061e2e 100644 --- a/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java +++ b/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java @@ -428,7 +428,8 @@ public class TestNumericRangeQuery64 extends LuceneTestCase { } last = new BytesRef(cur); } - assertNull(termEnum.next()); + // LUCENE-3314: the results after next() already returned null are undefined, + // assertNull(termEnum.next()); return count; }