Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

make sure we don't build circles with zero radius in ShapeTestUtil

iverase0864b39a116e
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 47cd3bd4bd0..62e71d1d2dc 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);
}