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 2021/12/02 14:53:15 UTC

[lucene] branch main updated: LUCENE-10278: don't write zero-sized array in this test (#501)

This is an automated email from the ASF dual-hosted git repository.

jpountz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new 77563c2  LUCENE-10278: don't write zero-sized array in this test (#501)
77563c2 is described below

commit 77563c2c150942828e70209820f1dfc6db131e54
Author: Robert Muir <rm...@apache.org>
AuthorDate: Thu Dec 2 09:53:09 2021 -0500

    LUCENE-10278: don't write zero-sized array in this test (#501)
    
    DocIdsWriter is not prepared for this.
---
 .../core/src/test/org/apache/lucene/util/bkd/TestDocIdsWriter.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lucene/core/src/test/org/apache/lucene/util/bkd/TestDocIdsWriter.java b/lucene/core/src/test/org/apache/lucene/util/bkd/TestDocIdsWriter.java
index 2473294..d2115c8 100644
--- a/lucene/core/src/test/org/apache/lucene/util/bkd/TestDocIdsWriter.java
+++ b/lucene/core/src/test/org/apache/lucene/util/bkd/TestDocIdsWriter.java
@@ -35,7 +35,7 @@ public class TestDocIdsWriter extends LuceneTestCase {
     int numIters = atLeast(100);
     try (Directory dir = newDirectory()) {
       for (int iter = 0; iter < numIters; ++iter) {
-        int[] docIDs = new int[random().nextInt(5000)];
+        int[] docIDs = new int[1 + random().nextInt(5000)];
         final int bpv = TestUtil.nextInt(random(), 1, 32);
         for (int i = 0; i < docIDs.length; ++i) {
           docIDs[i] = TestUtil.nextInt(random(), 0, (1 << bpv) - 1);
@@ -49,7 +49,7 @@ public class TestDocIdsWriter extends LuceneTestCase {
     int numIters = atLeast(100);
     try (Directory dir = newDirectory()) {
       for (int iter = 0; iter < numIters; ++iter) {
-        int[] docIDs = new int[random().nextInt(5000)];
+        int[] docIDs = new int[1 + random().nextInt(5000)];
         final int bpv = TestUtil.nextInt(random(), 1, 32);
         for (int i = 0; i < docIDs.length; ++i) {
           docIDs[i] = TestUtil.nextInt(random(), 0, (1 << bpv) - 1);
@@ -64,7 +64,7 @@ public class TestDocIdsWriter extends LuceneTestCase {
     int numIters = atLeast(100);
     try (Directory dir = newDirectory()) {
       for (int iter = 0; iter < numIters; ++iter) {
-        int size = random().nextInt(5000);
+        int size = 1 + random().nextInt(5000);
         Set<Integer> set = new HashSet<>(size);
         int small = random().nextInt(1000);
         while (set.size() < size) {