You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2016/09/12 14:31:31 UTC

[2/4] lucene-solr:branch_6x: LUCENE-7442: MinHashFilter's ctor should validate its args

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


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

Branch: refs/heads/branch_6x
Commit: 6fb22fcf55ce2883f45da285ee97a05e7a832579
Parents: 1b03c94
Author: Steve Rowe <sa...@apache.org>
Authored: Mon Sep 12 10:18:29 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Mon Sep 12 10:18:59 2016 -0400

----------------------------------------------------------------------
 lucene/CHANGES.txt                                          | 3 +++
 .../org/apache/lucene/analysis/minhash/MinHashFilter.java   | 9 +++++++++
 2 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6fb22fcf/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index dae94b5..da625c5 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -22,6 +22,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

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6fb22fcf/lucene/analysis/common/src/java/org/apache/lucene/analysis/minhash/MinHashFilter.java
----------------------------------------------------------------------
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/minhash/MinHashFilter.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/minhash/MinHashFilter.java
index 772f58a..4ddf711 100644
--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/minhash/MinHashFilter.java
+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/minhash/MinHashFilter.java
@@ -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;