You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2016/08/16 20:24:23 UTC

lucene-solr:branch_6x: LUCENE-7414: TestUtil.checkIterator can make tests very slow

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x dd927dba2 -> 7c6ea8e1e


LUCENE-7414: TestUtil.checkIterator can make tests very slow


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/7c6ea8e1
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/7c6ea8e1
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/7c6ea8e1

Branch: refs/heads/branch_6x
Commit: 7c6ea8e1e8643d0d9a09cb680d9eb7569a351512
Parents: dd927db
Author: Robert Muir <rm...@apache.org>
Authored: Tue Aug 16 16:12:55 2016 -0400
Committer: Robert Muir <rm...@apache.org>
Committed: Tue Aug 16 16:14:06 2016 -0400

----------------------------------------------------------------------
 .../src/java/org/apache/lucene/util/TestUtil.java      | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7c6ea8e1/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java b/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java
index b632160..19fcb3b 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java
@@ -177,11 +177,14 @@ public final class TestUtil {
       assert hasNext;
       T v = iterator.next();
       assert allowNull || v != null;
-      try {
-        iterator.remove();
-        throw new AssertionError("broken iterator (supports remove): " + iterator);
-      } catch (UnsupportedOperationException expected) {
-        // ok
+      // for the first element, check that remove is not supported
+      if (i == 0) {
+        try {
+          iterator.remove();
+          throw new AssertionError("broken iterator (supports remove): " + iterator);
+        } catch (UnsupportedOperationException expected) {
+          // ok
+        }
       }
     }
     assert !iterator.hasNext();