mirror of https://github.com/apache/lucene.git
fix bug in exception's message
This commit is contained in:
parent
585683d6a7
commit
ec60f5c43c
|
@ -72,7 +72,7 @@ public abstract class PointRangeQuery extends Query {
|
||||||
throw new IllegalArgumentException("lowerPoint is not a fixed multiple of numDims");
|
throw new IllegalArgumentException("lowerPoint is not a fixed multiple of numDims");
|
||||||
}
|
}
|
||||||
if (lowerPoint.length != upperPoint.length) {
|
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.numDims = numDims;
|
||||||
this.bytesPerDim = lowerPoint.length / numDims;
|
this.bytesPerDim = lowerPoint.length / numDims;
|
||||||
|
|
|
@ -2012,4 +2012,17 @@ public class TestPointQueries extends LuceneTestCase {
|
||||||
other[2] = (byte) 5;
|
other[2] = (byte) 5;
|
||||||
assertFalse(q1.equals(BinaryPoint.newSetQuery("a", new byte[][] {zeros, other})));
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue