lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [38/50] [abbrv] lucenenet git commit: Added missing guard clause to SimpleQueryParser.DefaultOperator.
Date Sun, 11 Sep 2016 21:31:09 GMT
Added missing guard clause to SimpleQueryParser.DefaultOperator.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/7b7b6348
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/7b7b6348
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/7b7b6348

Branch: refs/heads/master
Commit: 7b7b6348506b50734dad58fb0d2099904510a13b
Parents: 387d985
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Tue Aug 2 18:32:52 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Fri Sep 2 22:30:59 2016 +0700

----------------------------------------------------------------------
 .../Simple/SimpleQueryParser.cs                       | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7b7b6348/src/Lucene.Net.QueryParser/Simple/SimpleQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Simple/SimpleQueryParser.cs b/src/Lucene.Net.QueryParser/Simple/SimpleQueryParser.cs
index 1029c8b..8964d56 100644
--- a/src/Lucene.Net.QueryParser/Simple/SimpleQueryParser.cs
+++ b/src/Lucene.Net.QueryParser/Simple/SimpleQueryParser.cs
@@ -721,8 +721,18 @@ namespace Lucene.Net.QueryParser.Simple
         /// </summary>
         public virtual BooleanClause.Occur DefaultOperator
         {
-            get { return defaultOperator; }
-            set { defaultOperator = value; }
+            get 
+            { 
+                return defaultOperator; 
+            }
+            set 
+            {
+                if (value != BooleanClause.Occur.SHOULD && value != BooleanClause.Occur.MUST)
+                {
+                    throw new ArgumentException("invalid operator: only SHOULD or MUST are
allowed");
+                }
+                defaultOperator = value; 
+            }
         }
 
 


Mime
View raw message