You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2021/11/22 05:59:13 UTC
[lucenenet] branch master updated: BUG: Lucene.Net.TestFramework.Util.TestUtil::RandomAnalysisString() J2N.Randomizer.Next(int) throws ArgumentOutOfRangeException when the argument is 0 (confirmed this is how it works in Java). So, we need to skip the method in that case and pass 0 through.
This is an automated email from the ASF dual-hosted git repository.
nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
The following commit(s) were added to refs/heads/master by this push:
new ba1d70b BUG: Lucene.Net.TestFramework.Util.TestUtil::RandomAnalysisString() J2N.Randomizer.Next(int) throws ArgumentOutOfRangeException when the argument is 0 (confirmed this is how it works in Java). So, we need to skip the method in that case and pass 0 through.
ba1d70b is described below
commit ba1d70bfa683e2c86cc267753a24fa545ef0bed1
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Nov 21 19:58:39 2021 +0700
BUG: Lucene.Net.TestFramework.Util.TestUtil::RandomAnalysisString() J2N.Randomizer.Next(int) throws ArgumentOutOfRangeException when the argument is 0 (confirmed this is how it works in Java). So, we need to skip the method in that case and pass 0 through.
---
src/Lucene.Net.TestFramework/Util/TestUtil.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Lucene.Net.TestFramework/Util/TestUtil.cs b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
index 9a774b6..c159b15 100644
--- a/src/Lucene.Net.TestFramework/Util/TestUtil.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
@@ -952,7 +952,7 @@ namespace Lucene.Net.Util
// otherwise, try to make it more realistic with 'words' since most tests use MockTokenizer
// first decide how big the string will really be: 0..n
- maxLength = random.Next(maxLength);
+ maxLength = maxLength == 0 ? 0 : random.Next(maxLength); // LUCENENET: Lucene bug - random.Next(int) in Java must be > 0, and so must J2N.Randomizer. So, just pass through 0 as .NET would.
int avgWordLength = TestUtil.NextInt32(random, 3, 8);
StringBuilder sb = new StringBuilder();
while (sb.Length < maxLength)