Skip to content

Apache Lucene open-source search software

SOLR-10796: TestPointFields.testDoublePointFieldRangeFacet(): Guard against converting a double-valued '-Infinity' to BigDecimal (fix location #2)

Steve Rowe5f30765331fe
diff --git a/solr/core/src/test/org/apache/solr/schema/TestPointFields.java b/solr/core/src/test/org/apache/solr/schema/TestPointFields.java
index 5a89e7829c3..5d2adb4b289 100644
--- a/solr/core/src/test/org/apache/solr/schema/TestPointFields.java
+++ b/solr/core/src/test/org/apache/solr/schema/TestPointFields.java
@@ -746,7 +746,7 @@ public class TestPointFields extends SolrTestCaseJ4 {
max = sortedValues.get(sortedValues.size() - 1).val;
buffer = BigDecimal.valueOf(max).subtract(BigDecimal.valueOf(min))
.divide(BigDecimal.valueOf(numValues / 2), RoundingMode.HALF_UP).doubleValue();
- gap = BigDecimal.valueOf(max + buffer).subtract(BigDecimal.valueOf(min - buffer))
+ gap = BigDecimal.valueOf(max).subtract(BigDecimal.valueOf(min)).add(BigDecimal.valueOf(buffer * 2.0D))
.divide(BigDecimal.valueOf(numBuckets), RoundingMode.HALF_UP).doubleValue();
} while (max >= Double.MAX_VALUE - buffer || min <= -Double.MAX_VALUE + buffer);
// System.err.println("min: " + min + " max: " + max + " gap: " + gap + " buffer: " + buffer);