From 0864b39a116e38901537e6d7da137b9a6f35d231 Mon Sep 17 00:00:00 2001 From: iverase Date: Mon, 5 Oct 2020 10:45:31 +0200 Subject: [PATCH] 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 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); }