Apache Lucene open-source search software
fix bug in exception's message
Mike McCandlessc93c88dfb417
diff --git a/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java b/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.javaindex eb183e25840..4991096e7cf 100644--- a/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java+++ b/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java@@ -72,7 +72,7 @@ public abstract class PointRangeQuery extends Query {throw new IllegalArgumentException("lowerPoint is not a fixed multiple of numDims");}if (lowerPoint.length != upperPoint.length) {- throw new IllegalArgumentException("lowerPoint has length=" + numDims + " but upperPoint has different length=" + upperPoint.length);+ throw new IllegalArgumentException("lowerPoint has length=" + lowerPoint.length + " but upperPoint has different length=" + upperPoint.length);}this.numDims = numDims;this.bytesPerDim = lowerPoint.length / numDims;diff --git a/lucene/core/src/test/org/apache/lucene/search/TestPointQueries.java b/lucene/core/src/test/org/apache/lucene/search/TestPointQueries.javaindex c2136c4d663..bc9ef759a18 100644--- a/lucene/core/src/test/org/apache/lucene/search/TestPointQueries.java+++ b/lucene/core/src/test/org/apache/lucene/search/TestPointQueries.java@@ -2012,4 +2012,17 @@ public class TestPointQueries extends LuceneTestCase {other[2] = (byte) 5;assertFalse(q1.equals(BinaryPoint.newSetQuery("a", new byte[][] {zeros, other})));}++ public void testInvalidPointLength() {+ IllegalArgumentException e = expectThrows(IllegalArgumentException.class,+ () -> {+ new PointRangeQuery("field", new byte[4], new byte[8], 1) {+ @Override+ protected String toString(int dimension, byte[] value) {+ return "foo";+ }+ };+ });+ assertEquals("lowerPoint has length=4 but upperPoint has different length=8", e.getMessage());+ }}