lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [44/58] lucenenet git commit: QueryParser.Flexible: Fixed all compiler warnings.
Date Tue, 06 Dec 2016 15:12:19 GMT
QueryParser.Flexible: Fixed all compiler warnings.


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

Branch: refs/heads/master
Commit: 43ec320a5fecd0bd6f1a1d6cea4831074469c764
Parents: 4c85b79
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Mon Dec 5 23:39:11 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon Dec 5 23:39:11 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.QueryParser/Flexible/Messages/NLS.cs |  8 ++++++++
 .../Standard/Builders/FuzzyQueryNodeBuilder.cs      |  2 ++
 .../Flexible/Standard/Config/FuzzyConfig.cs         |  2 ++
 .../Flexible/Standard/Config/NumericConfig.cs       | 14 ++++++++++++++
 .../Flexible/Standard/Parser/FastCharStream.cs      |  2 ++
 .../Standard/Parser/StandardSyntaxParser.cs         | 16 ++++++++++++++++
 .../Parser/StandardSyntaxParserTokenManager.cs      | 16 ++++++++++++++++
 .../Processors/AnalyzerQueryNodeProcessor.cs        | 12 ++++++++++++
 .../Processors/TermRangeQueryNodeProcessor.cs       |  2 ++
 .../Flexible/Standard/StandardQueryParser.cs        |  5 ++++-
 .../Precedence/TestPrecedenceQueryParser.cs         | 10 ++++++++++
 .../Flexible/Spans/TestSpanQueryParser.cs           | 14 ++++++++++++++
 .../Flexible/Standard/TestMultiAnalyzerQPHelper.cs  |  4 ++++
 .../Flexible/Standard/TestMultiFieldQPHelper.cs     | 10 ++++++++++
 .../Flexible/Standard/TestNumericQueryParser.cs     |  2 +-
 .../Flexible/Standard/TestQPHelper.cs               | 16 ++++++++++++++++
 .../Flexible/Standard/TestStandardQP.cs             |  4 ++++
 17 files changed, 137 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.QueryParser/Flexible/Messages/NLS.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Messages/NLS.cs b/src/Lucene.Net.QueryParser/Flexible/Messages/NLS.cs
index c076f9c..762314f 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Messages/NLS.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Messages/NLS.cs
@@ -127,7 +127,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Messages
                 if (!bundles.ContainsKey(bundleName))
                     bundles[bundleName] = clazz;
             }
+#pragma warning disable 168
             catch (Exception e)
+#pragma warning restore 168
             {
                 // ignore all errors and exceptions
                 // because this function is supposed to be called at class load time.
@@ -153,7 +155,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Messages
                             if (obj != null)
                                 return obj;
                         }
+#pragma warning disable 168
                         catch (MissingManifestResourceException e)
+#pragma warning restore 168
                         {
                             // just continue it might be on the next resource bundle
                         }
@@ -214,12 +218,16 @@ namespace Lucene.Net.QueryParsers.Flexible.Messages
                     }
                 }
             }
+#pragma warning disable 168
             catch (MissingManifestResourceException e)
+#pragma warning restore 168
             {
                 //System.err.println("WARN: Message with key:" + key + " and locale: "
                 //    + Locale.getDefault() + " not found.");
             }
+#pragma warning disable 168
             catch (Exception e)
+#pragma warning restore 168
             {
                 // ignore all other errors and exceptions
                 // since this code is just a test to see if the message is present on the

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs
index e0a9a61..3fa9c06 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs
@@ -37,8 +37,10 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
             FuzzyQueryNode fuzzyNode = (FuzzyQueryNode)queryNode;
             string text = fuzzyNode.GetTextAsString();
 
+#pragma warning disable 612, 618
             int numEdits = FuzzyQuery.FloatToEdits(fuzzyNode.Similarity,
                 text.CodePointCount(0, text.Length));
+#pragma warning restore 612, 618
 
             return new FuzzyQuery(new Term(fuzzyNode.GetFieldAsString(), fuzzyNode
                 .GetTextAsString()), numEdits, fuzzyNode

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/FuzzyConfig.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/FuzzyConfig.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/FuzzyConfig.cs
index 4e879fd..a4e52ee 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/FuzzyConfig.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/FuzzyConfig.cs
@@ -26,7 +26,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Config
     {
         private int prefixLength = FuzzyQuery.DefaultPrefixLength;
 
+#pragma warning disable 612, 618
         private float minSimilarity = FuzzyQuery.DefaultMinSimilarity;
+#pragma warning restore 612, 618
 
         public FuzzyConfig() { }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumericConfig.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumericConfig.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumericConfig.cs
index a1f94f4..fb2db14 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumericConfig.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumericConfig.cs
@@ -107,5 +107,19 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Config
 
             return false;
         }
+
+        /// <summary>
+        /// LUCENENET specific - Visual Studio provides a compiler warning if
+        /// <see cref="Equals(object)"/> is overridden without <see cref="GetHashCode()"/>,
+        /// so we provide an implementation that mirrors <see cref="Equals(object)"/>.
+        /// </summary>
+        public override int GetHashCode()
+        {
+            return HashHelpers.CombineHashCodes(
+                base.GetHashCode(), 
+                this.precisionStep.GetHashCode(), 
+                this.type.GetHashCode(), 
+                this.format.GetHashCode());
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/FastCharStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/FastCharStream.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/FastCharStream.cs
index 8538374..6f6d27d 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/FastCharStream.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/FastCharStream.cs
@@ -116,7 +116,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
             {
                 input.Dispose();
             }
+#pragma warning disable 168
             catch (IOException e)
+#pragma warning restore 168
             {
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs
index 9f75881..993aa34 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs
@@ -546,7 +546,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
                         q = new BoostQueryNode(q, f);
                     }
                 }
+#pragma warning disable 168
                 catch (Exception ignored)
+#pragma warning restore 168
                 {
                     /* Should this be handled somehow? (defaults to "no boost", if
                          * boost number is invalid)
@@ -567,7 +569,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
             bool endInc = false;
             IQueryNode q = null;
             FieldQueryNode qLower, qUpper;
+#pragma warning disable 612, 618
             float defaultMinSimilarity = Search.FuzzyQuery.DefaultMinSimilarity;
+#pragma warning restore 612, 618
             switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
             {
                 case RegexpToken.TERM:
@@ -628,7 +632,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
                         {
                             fms = Convert.ToSingle(fuzzySlop.image.Substring(1), CultureInfo.InvariantCulture);
                         }
+#pragma warning disable 168
                         catch (Exception ignored) { }
+#pragma warning restore 168
                         if (fms < 0.0f)
                         {
                             { if (true) throw new ParseException(new MessageImpl(QueryParserMessages.INVALID_SYNTAX_FUZZY_LIMITS));
}
@@ -766,7 +772,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
                             phraseSlop = (int)Convert.ToSingle(fuzzySlop.image.Substring(1),
CultureInfo.InvariantCulture);
                             q = new SlopQueryNode(q, phraseSlop);
                         }
+#pragma warning disable 168
                         catch (Exception ignored)
+#pragma warning restore 168
                         {
                             /* Should this be handled somehow? (defaults to "no PhraseSlop",
if
                            * slop number is invalid)
@@ -791,7 +799,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
                         q = new BoostQueryNode(q, f);
                     }
                 }
+#pragma warning disable 168
                 catch (Exception ignored)
+#pragma warning restore 168
                 {
                     /* Should this be handled somehow? (defaults to "no boost", if
                        * boost number is invalid)
@@ -806,7 +816,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
         {
             jj_la = xla; jj_lastpos = jj_scanpos = token;
             try { return !jj_3_1(); }
+#pragma warning disable 168
             catch (LookaheadSuccess ls) { return true; }
+#pragma warning restore 168
             finally { jj_save(0, xla); }
         }
 
@@ -814,7 +826,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
         {
             jj_la = xla; jj_lastpos = jj_scanpos = token;
             try { return !jj_3_2(); }
+#pragma warning disable 168
             catch (LookaheadSuccess ls) { return true; }
+#pragma warning restore 168
             finally { jj_save(1, xla); }
         }
 
@@ -1243,7 +1257,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
                         p = p.next;
                     } while (p != null);
                 }
+#pragma warning disable 168
                 catch (LookaheadSuccess ls) { }
+#pragma warning restore 168
             }
             jj_rescan = false;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs
index 8095ef6..73ce875 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs
@@ -82,7 +82,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
         private int jjMoveStringLiteralDfa1_2(long active0)
         {
             try { curChar = input_stream.ReadChar(); }
+#pragma warning disable 168
             catch (IOException e)
+#pragma warning restore 168
             {
                 jjStopStringLiteralDfa_2(0, active0);
                 return 1;
@@ -421,7 +423,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
                 if ((i = jjnewStateCnt) == (startsAt = 33 - (jjnewStateCnt = startsAt)))
                     return curPos;
                 try { curChar = input_stream.ReadChar(); }
+#pragma warning disable 168
                 catch (IOException e) { return curPos; }
+#pragma warning restore 168
             }
         }
         private int jjMoveStringLiteralDfa0_0()
@@ -507,7 +511,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
                 if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
                     return curPos;
                 try { curChar = input_stream.ReadChar(); }
+#pragma warning disable 168
                 catch (IOException e) { return curPos; }
+#pragma warning restore 168
             }
         }
         private int jjStopStringLiteralDfa_1(int pos, long active0)
@@ -546,7 +552,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
         private int jjMoveStringLiteralDfa1_1(long active0)
         {
             try { curChar = input_stream.ReadChar(); }
+#pragma warning disable 168
             catch (IOException e)
+#pragma warning restore 168
             {
                 jjStopStringLiteralDfa_1(0, active0);
                 return 1;
@@ -567,7 +575,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
             jjmatchedKind = kind;
             jjmatchedPos = pos;
             try { curChar = input_stream.ReadChar(); }
+#pragma warning disable 168
             catch (IOException e) { return pos + 1; }
+#pragma warning restore 168
             return jjMoveNfa_1(state, pos + 1);
         }
         private int jjMoveNfa_1(int startState, int curPos)
@@ -708,7 +718,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
                 if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
                     return curPos;
                 try { curChar = input_stream.ReadChar(); }
+#pragma warning disable 168
                 catch (IOException e) { return curPos; }
+#pragma warning restore 168
             }
         }
         internal static readonly int[] jjnextStates = {
@@ -869,7 +881,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
                 {
                     curChar = input_stream.BeginToken();
                 }
+#pragma warning disable 168
                 catch (IOException e)
+#pragma warning restore 168
                 {
                     jjmatchedKind = 0;
                     matchedToken = jjFillToken();
@@ -917,7 +931,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
                 string error_after = null;
                 bool EOFSeen = false;
                 try { input_stream.ReadChar(); input_stream.BackUp(1); }
+#pragma warning disable 168
                 catch (IOException e1)
+#pragma warning restore 168
                 {
                     EOFSeen = true;
                     error_after = curPos <= 1 ? "" : input_stream.GetImage();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs
index fb6001c..135fd99 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs
@@ -138,7 +138,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
                             }
                         }
                     }
+#pragma warning disable 168
                     catch (IOException e)
+#pragma warning restore 168
                     {
                         // ignore
                     }
@@ -177,7 +179,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
                         Debug.Assert(hasNext == true);
                         term = termAtt.ToString();
                     }
+#pragma warning disable 168
                     catch (IOException e)
+#pragma warning restore 168
                     {
                         // safe to ignore, because we know the number of tokens
                     }
@@ -206,7 +210,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
                                     Debug.Assert(hasNext == true);
                                     term = termAtt.ToString();
                                 }
+#pragma warning disable 168
                                 catch (IOException e)
+#pragma warning restore 168
                                 {
                                     // safe to ignore, because we know the number of tokens
                                 }
@@ -231,7 +237,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
                                     Debug.Assert(hasNext == true);
                                     term = termAtt.ToString();
                                 }
+#pragma warning disable 168
                                 catch (IOException e)
+#pragma warning restore 168
                                 {
                                     // safe to ignore, because we know the number of tokens
                                 }
@@ -300,7 +308,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
                                     positionIncrement = posIncrAtt.PositionIncrement;
                                 }
                             }
+#pragma warning disable 168
                             catch (IOException e)
+#pragma warning restore 168
                             {
                                 // safe to ignore, because we know the number of tokens
                             }
@@ -371,7 +381,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
                                 positionIncrement = posIncrAtt.PositionIncrement;
                             }
                         }
+#pragma warning disable 168
                         catch (IOException e)
+#pragma warning restore 168
                         {
                             // safe to ignore, because we know the number of tokens
                         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/TermRangeQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/TermRangeQueryNodeProcessor.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/TermRangeQueryNodeProcessor.cs
index 23cb18d..2ee2b59 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/TermRangeQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/TermRangeQueryNodeProcessor.cs
@@ -144,7 +144,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
                         upper.Text = new StringCharSequenceWrapper(part2);
                     }
                 }
+#pragma warning disable 168
                 catch (Exception e)
+#pragma warning restore 168
                 {
                     // do nothing
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs
index d06b05f..48900b7 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs
@@ -393,7 +393,10 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
             get
             {
                 FuzzyConfig fuzzyConfig = QueryConfigHandler.Get(ConfigurationKeys.FUZZY_CONFIG);
-                return (fuzzyConfig != null) ? fuzzyConfig.MinSimilarity : FuzzyQuery.DefaultMinSimilarity;
+                return (fuzzyConfig != null) ? fuzzyConfig.MinSimilarity
+#pragma warning disable 612, 618
+                    : FuzzyQuery.DefaultMinSimilarity;
+#pragma warning restore 612, 618
             }
             set
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
b/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
index 266869a..6290faa 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
@@ -329,7 +329,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
                 GetQuery("term~1.1", null); // value > 1, throws exception
                 fail();
             }
+#pragma warning disable 168
             catch (ParseException pe)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -482,14 +484,18 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
             IDictionary<string, DateTools.Resolution?> fieldMap = new HashMap<string,
DateTools.Resolution?>();
             // set a field specific date resolution
             fieldMap.Put(monthField, DateTools.Resolution.MONTH);
+#pragma warning disable 612, 618
             qp.SetDateResolution(fieldMap);
+#pragma warning restore 612, 618
 
             // set default date resolution to MILLISECOND
             qp.SetDateResolution(DateTools.Resolution.MILLISECOND);
 
             // set second field specific date resolution
             fieldMap.Put(hourField, DateTools.Resolution.HOUR);
+#pragma warning disable 612, 618
             qp.SetDateResolution(fieldMap);
+#pragma warning restore 612, 618
 
             // for this field no field specific date resolution has been set,
             // so verify if the default resolution is used
@@ -648,7 +654,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
                 assertQueryEquals("\"some phrase", null, "abc");
                 fail("ParseException expected, not thrown");
             }
+#pragma warning disable 168
             catch (QueryNodeParseException expected)
+#pragma warning restore 168
             {
             }
         }
@@ -662,7 +670,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
                 GetParser(new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false)).Parse("one
two three", "field");
                 fail("ParseException expected due to too many boolean clauses");
             }
+#pragma warning disable 168
             catch (QueryNodeException expected)
+#pragma warning restore 168
             {
                 // too many boolean clauses, so ParseException is expected
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParser.cs
index 5511a0a..330d01a 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParser.cs
@@ -175,7 +175,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
                 fail("QueryNodeException was expected, wildcard queries should not be supported");
 
             }
+#pragma warning disable 168
             catch (QueryNodeException ex)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -186,7 +188,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
                 fail("QueryNodeException was expected, range queries should not be supported");
 
             }
+#pragma warning disable 168
             catch (QueryNodeException ex)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -197,7 +201,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
                 fail("QueryNodeException was expected, boost queries should not be supported");
 
             }
+#pragma warning disable 168
             catch (QueryNodeException ex)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -208,7 +214,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
                 fail("QueryNodeException was expected, fuzzy queries should not be supported");
 
             }
+#pragma warning disable 168
             catch (QueryNodeException ex)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -219,7 +227,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
                 fail("QueryNodeException was expected, quoted queries should not be supported");
 
             }
+#pragma warning disable 168
             catch (QueryNodeException ex)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -230,7 +240,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
                 fail("QueryNodeException was expected, parenthesized queries should not be
supported");
 
             }
+#pragma warning disable 168
             catch (QueryNodeException ex)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -241,7 +253,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
                 fail("QueryNodeException was expected, and queries should not be supported");
 
             }
+#pragma warning disable 168
             catch (QueryNodeException ex)
+#pragma warning restore 168
             {
                 // expected exception
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiAnalyzerQPHelper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiAnalyzerQPHelper.cs
b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiAnalyzerQPHelper.cs
index c7318a6..6138072 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiAnalyzerQPHelper.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiAnalyzerQPHelper.cs
@@ -90,12 +90,16 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 .toString());
 
             // phrase after changing default slop
+#pragma warning disable 612, 618
             qp.SetDefaultPhraseSlop(99);
+#pragma warning restore 612, 618
             assertEquals("\"(multi multi2) foo\"~99 bar", qp.Parse("\"multi foo\" bar",
                 "").toString());
             assertEquals("\"(multi multi2) foo\"~99 \"foo bar\"~2", qp.Parse(
                 "\"multi foo\" \"foo bar\"~2", "").toString());
+#pragma warning disable 612, 618
             qp.SetDefaultPhraseSlop(0);
+#pragma warning restore 612, 618
 
             // non-default operator:
             qp.DefaultOperator = (StandardQueryConfigHandler.Operator.AND);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiFieldQPHelper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiFieldQPHelper.cs
b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiFieldQPHelper.cs
index 6902ee3..6124675 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiFieldQPHelper.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiFieldQPHelper.cs
@@ -203,7 +203,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 q = QueryParserUtil.Parse(queries5, fields, new MockAnalyzer(Random()));
                 fail();
             }
+#pragma warning disable 168
             catch (ArgumentException e)
+#pragma warning restore 168
             {
                 // expected exception, array length differs
             }
@@ -243,7 +245,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 q = QueryParserUtil.Parse("blah", fields, flags2, new MockAnalyzer(Random()));
                 fail();
             }
+#pragma warning disable 168
             catch (ArgumentException e)
+#pragma warning restore 168
             {
                 // expected exception, array length differs
             }
@@ -276,7 +280,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 q = QueryParserUtil.Parse("blah", fields, flags2, new MockAnalyzer(Random()));
                 fail();
             }
+#pragma warning disable 168
             catch (ArgumentException e)
+#pragma warning restore 168
             {
                 // expected exception, array length differs
             }
@@ -304,7 +310,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                     .Parse(queries, fields, flags2, new MockAnalyzer(Random()));
                 fail();
             }
+#pragma warning disable 168
             catch (ArgumentException e)
+#pragma warning restore 168
             {
                 // expected exception, array length differs
             }
@@ -332,7 +340,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                     .Parse(queries, fields, flags2, new MockAnalyzer(Random()));
                 fail();
             }
+#pragma warning disable 168
             catch (ArgumentException e)
+#pragma warning restore 168
             {
                 // expected exception, array length differs
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
index 3c1e220..e0dcf8f 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
@@ -225,7 +225,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
             FieldType ft = new FieldType(LongField.TYPE_NOT_STORED);
             ft.Stored = (true);
             ft.NumericPrecisionStep = (PRECISION_STEP);
-            LongField dateField = new LongField(DATE_FIELD_NAME, 0l, ft);
+            LongField dateField = new LongField(DATE_FIELD_NAME, 0L, ft);
             numericFieldMap.Put(DATE_FIELD_NAME, dateField);
             doc.Add(dateField);
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
index 8d4f434..6a9c9e7 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
@@ -628,7 +628,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 AssertWildcardQueryEquals("*Term", true, "*term");
                 fail();
             }
+#pragma warning disable 168
             catch (QueryNodeException pe)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -637,7 +639,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 AssertWildcardQueryEquals("?Term", true, "?term");
                 fail();
             }
+#pragma warning disable 168
             catch (QueryNodeException pe)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -795,14 +799,18 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
 
             // set a field specific date resolution    
             dateRes.Put(monthField, DateTools.Resolution.MONTH);
+#pragma warning disable 612, 618
             qp.SetDateResolution(dateRes);
+#pragma warning restore 612, 618
 
             // set default date resolution to MILLISECOND
             qp.SetDateResolution(DateTools.Resolution.MILLISECOND);
 
             // set second field specific date resolution
             dateRes.Put(hourField, DateTools.Resolution.HOUR);
+#pragma warning disable 612, 618
             qp.SetDateResolution(dateRes);
+#pragma warning restore 612, 618
 
             // for this field no field specific date resolution has been set,
             // so verify if the default resolution is used
@@ -1048,7 +1056,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
             {
                 GetQuery(queryString, null);
             }
+#pragma warning disable 168
             catch (QueryNodeException expected)
+#pragma warning restore 168
             {
                 return;
             }
@@ -1073,7 +1083,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 new QPTestParser(new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false)).Parse("a?t",
"contents");
                 fail("Wildcard queries should not be allowed");
             }
+#pragma warning disable 168
             catch (QueryNodeException expected)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -1086,7 +1098,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 new QPTestParser(new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false)).Parse("xunit~",
"contents");
                 fail("Fuzzy queries should not be allowed");
             }
+#pragma warning disable 168
             catch (QueryNodeException expected)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -1104,7 +1118,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 qp.Parse("one two three", "field");
                 fail("ParseException expected due to too many boolean clauses");
             }
+#pragma warning disable 168
             catch (QueryNodeException expected)
+#pragma warning restore 168
             {
                 // too many boolean clauses, so ParseException is expected
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43ec320a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestStandardQP.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestStandardQP.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestStandardQP.cs
index 6fdbb54..24046a7 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestStandardQP.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestStandardQP.cs
@@ -175,7 +175,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 SetAnalyzeRangeTerms(GetParser(null), true);
                 base.TestCollatedRange();
             }
+#pragma warning disable 168
             catch (NotSupportedException e)
+#pragma warning restore 168
             {
                 // expected
             }
@@ -189,7 +191,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 SetAutoGeneratePhraseQueries(GetParser(null), true);
                 base.TestAutoGeneratePhraseQueriesOn();
             }
+#pragma warning disable 168
             catch (NotSupportedException e)
+#pragma warning restore 168
             {
                 // expected
             }


Mime
View raw message