You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kr...@apache.org on 2017/01/03 18:48:56 UTC
[45/50] lucene-solr:jira/solr-8593: don't allow position length < 1
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/7b2e3db5
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/7b2e3db5
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/7b2e3db5
Branch: refs/heads/jira/solr-8593
Commit: 7b2e3db5531d42d91c2718737c63c2ce4d873c8e
Parents: 018df31
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:11 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/7b2e3db5/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;
}