You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rj...@apache.org on 2016/03/20 21:50:06 UTC

lucene-solr:master: LUCENE-7118: Move numDims check before modulo numDims

Repository: lucene-solr
Updated Branches:
  refs/heads/master 54e662b6d -> 7f9c4d886


LUCENE-7118: Move numDims check before modulo numDims


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/7f9c4d88
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/7f9c4d88
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/7f9c4d88

Branch: refs/heads/master
Commit: 7f9c4d886dbef50e31fda38d77d73a5bd3b7b8be
Parents: 54e662b
Author: Ryan Ernst <rj...@apache.org>
Authored: Sun Mar 20 13:49:33 2016 -0700
Committer: Ryan Ernst <rj...@apache.org>
Committed: Sun Mar 20 13:49:33 2016 -0700

----------------------------------------------------------------------
 .../src/java/org/apache/lucene/search/PointRangeQuery.java     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7f9c4d88/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java b/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java
index d798c22..cfa644f 100644
--- a/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java
@@ -62,6 +62,9 @@ public abstract class PointRangeQuery extends Query {
   protected PointRangeQuery(String field, byte[] lowerPoint, byte[] upperPoint, int numDims) {
     checkArgs(field, lowerPoint, upperPoint);
     this.field = field;
+    if (numDims <= 0) {
+      throw new IllegalArgumentException("numDims must be positive, got " + numDims);
+    }
     if (lowerPoint.length == 0) {
       throw new IllegalArgumentException("lowerPoint has length of zero");
     }
@@ -71,9 +74,6 @@ public abstract class PointRangeQuery extends Query {
     if (lowerPoint.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.bytesPerDim = lowerPoint.length / numDims;