From 37b1415b578a43b45c9acd82095d14e6bca3948b Mon Sep 17 00:00:00 2001 From: kimchy Date: Tue, 8 Feb 2011 11:57:07 +0200 Subject: [PATCH] Improve error when creating a percolator with no query, closes #669. --- .../org/elasticsearch/index/percolator/PercolatorExecutor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/percolator/PercolatorExecutor.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/percolator/PercolatorExecutor.java index 3dbe53b824d..9992baad229 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/percolator/PercolatorExecutor.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/percolator/PercolatorExecutor.java @@ -29,6 +29,7 @@ import org.apache.lucene.search.Query; import org.apache.lucene.search.Scorer; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.common.Nullable; +import org.elasticsearch.common.Preconditions; import org.elasticsearch.common.Strings; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.collect.MapBuilder; @@ -243,6 +244,7 @@ public class PercolatorExecutor extends AbstractIndexComponent { } public synchronized void addQuery(String name, Query query) { + Preconditions.checkArgument(query != null, "query must be provided for percolate request"); this.queries = MapBuilder.newMapBuilder(queries).put(name, query).immutableMap(); }