You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by iv...@apache.org on 2020/10/05 08:47:10 UTC
[lucene-solr] branch branch_8x updated: make sure we don't build
circles with zero radius in ShapeTestUtil
This is an automated email from the ASF dual-hosted git repository.
ivera pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new 93809ac make sure we don't build circles with zero radius in ShapeTestUtil
93809ac is described below
commit 93809ac361ceeb0703ef2dd0b24a4507e8973b78
Author: iverase <iv...@apache.org>
AuthorDate: Mon Oct 5 10:45:31 2020 +0200
make sure we don't build circles with zero radius in ShapeTestUtil
---
.../src/java/org/apache/lucene/geo/ShapeTestUtil.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lucene/test-framework/src/java/org/apache/lucene/geo/ShapeTestUtil.java b/lucene/test-framework/src/java/org/apache/lucene/geo/ShapeTestUtil.java
index ddb3acb..ff79fcf 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/geo/ShapeTestUtil.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/geo/ShapeTestUtil.java
@@ -71,7 +71,11 @@ public class ShapeTestUtil {
Random random = random();
float x = nextFloat(random);
float y = nextFloat(random);
- float radius = random().nextFloat() * Float.MAX_VALUE / 2;
+ float radius = 0;
+ while (radius == 0) {
+ radius = random().nextFloat() * Float.MAX_VALUE / 2;
+ }
+ assert radius != 0;
return new XYCircle(x, y, radius);
}