Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

fix very rare test bug that I somehow hit

Mike McCandlessf1c044a2d779
diff --git a/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.java b/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.java
index e7e5d572088..9fde6e3ed9f 100644
--- a/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.java
+++ b/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.java
@@ -421,7 +421,10 @@ public class TestRangeFacetCounts extends FacetTestCase {
}
boolean minIncl;
boolean maxIncl;
- if (min == max) {
+
+ // NOTE: max - min >= 0 is here to handle the common overflow case!
+ if (max - min >= 0 && max - min < 2) {
+ // If max == min or max == min+1, we always do inclusive, else we might pass an empty range and hit exc from LongRange's ctor:
minIncl = true;
maxIncl = true;
} else {