mirror of https://github.com/apache/lucene.git
LUCENE-7118: Move numDims check before modulo numDims
This commit is contained in:
parent
54e662b6da
commit
7f9c4d886d
|
@ -62,6 +62,9 @@ public abstract class PointRangeQuery extends Query {
|
||||||
protected PointRangeQuery(String field, byte[] lowerPoint, byte[] upperPoint, int numDims) {
|
protected PointRangeQuery(String field, byte[] lowerPoint, byte[] upperPoint, int numDims) {
|
||||||
checkArgs(field, lowerPoint, upperPoint);
|
checkArgs(field, lowerPoint, upperPoint);
|
||||||
this.field = field;
|
this.field = field;
|
||||||
|
if (numDims <= 0) {
|
||||||
|
throw new IllegalArgumentException("numDims must be positive, got " + numDims);
|
||||||
|
}
|
||||||
if (lowerPoint.length == 0) {
|
if (lowerPoint.length == 0) {
|
||||||
throw new IllegalArgumentException("lowerPoint has length of zero");
|
throw new IllegalArgumentException("lowerPoint has length of zero");
|
||||||
}
|
}
|
||||||
|
@ -71,9 +74,6 @@ public abstract class PointRangeQuery extends Query {
|
||||||
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=" + numDims + " but upperPoint has different length=" + upperPoint.length);
|
||||||
}
|
}
|
||||||
if (numDims <= 0) {
|
|
||||||
throw new IllegalArgumentException("numDims must be positive, got " + numDims);
|
|
||||||
}
|
|
||||||
this.numDims = numDims;
|
this.numDims = numDims;
|
||||||
this.bytesPerDim = lowerPoint.length / numDims;
|
this.bytesPerDim = lowerPoint.length / numDims;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue