LUCENE-7442: MinHashFilter's ctor should validate its args

This commit is contained in:
Steve Rowe 2016-09-12 10:18:29 -04:00
parent f177a660f5
commit 36362a2a69
2 changed files with 12 additions and 0 deletions

View File

@ -53,6 +53,9 @@ Bug Fixes
ArrayIndexOutOfBoundsException exception on large index segments (>1.8B docs)
with large skips. (yonik)
* LUCENE-7442: MinHashFilter's ctor should validate its args.
(Cao Manh Dat via Steve Rowe)
Improvements
Optimizations

View File

@ -114,6 +114,15 @@ public class MinHashFilter extends TokenFilter {
*/
public MinHashFilter(TokenStream input, int hashCount, int bucketCount, int hashSetSize, boolean withRotation) {
super(input);
if (hashCount <= 0) {
throw new IllegalArgumentException("hashCount must be greater than zero");
}
if (bucketCount <= 0) {
throw new IllegalArgumentException("bucketCount must be greater than zero");
}
if (hashSetSize <= 0) {
throw new IllegalArgumentException("hashSetSize must be greater than zero");
}
this.hashCount = hashCount;
this.bucketCount = bucketCount;
this.hashSetSize = hashSetSize;