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 2017/01/03 10:46:48 UTC

lucene-solr:branch_6x: don't allow position length < 1

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x c980f6a1c -> 4eca6dc91


don't allow position length < 1


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

Branch: refs/heads/branch_6x
Commit: 4eca6dc915db4caa07777c4cdb086ff5efde2425
Parents: c980f6a
Author: Mike McCandless <mi...@apache.org>
Authored: Tue Jan 3 05:46:11 2017 -0500
Committer: Mike McCandless <mi...@apache.org>
Committed: Tue Jan 3 05:46:35 2017 -0500

----------------------------------------------------------------------
 .../analysis/tokenattributes/PackedTokenAttributeImpl.java  | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4eca6dc9/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PackedTokenAttributeImpl.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PackedTokenAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PackedTokenAttributeImpl.java
index aaa3316..c89a374 100644
--- a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PackedTokenAttributeImpl.java
+++ b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PackedTokenAttributeImpl.java
@@ -46,9 +46,9 @@ public class PackedTokenAttributeImpl extends CharTermAttributeImpl
    */
   @Override
   public void setPositionIncrement(int positionIncrement) {
-    if (positionIncrement < 0)
-      throw new IllegalArgumentException
-        ("Increment must be zero or greater: " + positionIncrement);
+    if (positionIncrement < 0) {
+      throw new IllegalArgumentException("Increment must be zero or greater: " + positionIncrement);
+    }
     this.positionIncrement = positionIncrement;
   }
 
@@ -67,6 +67,9 @@ public class PackedTokenAttributeImpl extends CharTermAttributeImpl
    */
   @Override
   public void setPositionLength(int positionLength) {
+    if (positionLength < 1) {
+      throw new IllegalArgumentException("Position length must be 1 or greater: got " + positionLength);
+    }
     this.positionLength = positionLength;
   }