You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2016/10/04 09:27:32 UTC

lucene-solr:master: LUCENE-7467: improve exception message when token position overflows int

Repository: lucene-solr
Updated Branches:
  refs/heads/master 32446e920 -> 01ecc0691


LUCENE-7467: improve exception message when token position overflows int


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

Branch: refs/heads/master
Commit: 01ecc06915887d7700e9eae8746bf04eda975abc
Parents: 32446e9
Author: Mike McCandless <mi...@apache.org>
Authored: Tue Oct 4 05:27:21 2016 -0400
Committer: Mike McCandless <mi...@apache.org>
Committed: Tue Oct 4 05:27:21 2016 -0400

----------------------------------------------------------------------
 .../src/java/org/apache/lucene/index/DefaultIndexingChain.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/01ecc069/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java b/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java
index 55cdbf3..e941911 100644
--- a/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java
+++ b/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java
@@ -723,8 +723,10 @@ final class DefaultIndexingChain extends DocConsumer {
           if (invertState.position < invertState.lastPosition) {
             if (posIncr == 0) {
               throw new IllegalArgumentException("first position increment must be > 0 (got 0) for field '" + field.name() + "'");
+            } else if (posIncr < 0) {
+              throw new IllegalArgumentException("position increment must be >= 0 (got " + posIncr + ") for field '" + field.name() + "'");
             } else {
-              throw new IllegalArgumentException("position increments (and gaps) must be >= 0 (got " + posIncr + ") for field '" + field.name() + "'");
+              throw new IllegalArgumentException("position overflowed Integer.MAX_VALUE (got posIncr=" + posIncr + " lastPosition=" + invertState.lastPosition + " position=" + invertState.position + ") for field '" + field.name() + "'");
             }
           } else if (invertState.position > IndexWriter.MAX_POSITION) {
             throw new IllegalArgumentException("position " + invertState.position + " is too large for field '" + field.name() + "': max allowed position is " + IndexWriter.MAX_POSITION);