lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [07/50] [abbrv] lucenenet git commit: Lucene.Net.Tests: suppressed warnings about unused variables on caught exceptions
Date Wed, 25 Jan 2017 03:43:51 GMT
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Search/TestFieldCache.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestFieldCache.cs b/src/Lucene.Net.Tests/core/Search/TestFieldCache.cs
index 6534aa9..7051455 100644
--- a/src/Lucene.Net.Tests/core/Search/TestFieldCache.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestFieldCache.cs
@@ -614,7 +614,9 @@ namespace Lucene.Net.Search
                 FieldCache.DEFAULT.GetInts(ar, "binary", false);
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (InvalidOperationException expected)
+#pragma warning restore 168
             {
             }
 
@@ -627,7 +629,9 @@ namespace Lucene.Net.Search
                 FieldCache.DEFAULT.GetTermsIndex(ar, "binary");
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (InvalidOperationException expected)
+#pragma warning restore 168
             {
             }
 
@@ -636,7 +640,9 @@ namespace Lucene.Net.Search
                 FieldCache.DEFAULT.GetDocTermOrds(ar, "binary");
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (InvalidOperationException expected)
+#pragma warning restore 168
             {
             }
 
@@ -645,7 +651,9 @@ namespace Lucene.Net.Search
                 new DocTermOrds(ar, null, "binary");
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (InvalidOperationException expected)
+#pragma warning restore 168
             {
             }
 
@@ -658,7 +666,9 @@ namespace Lucene.Net.Search
                 FieldCache.DEFAULT.GetInts(ar, "sorted", false);
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (InvalidOperationException expected)
+#pragma warning restore 168
             {
             }
 
@@ -667,7 +677,9 @@ namespace Lucene.Net.Search
                 new DocTermOrds(ar, null, "sorted");
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (InvalidOperationException expected)
+#pragma warning restore 168
             {
             }
 
@@ -699,7 +711,9 @@ namespace Lucene.Net.Search
                 FieldCache.DEFAULT.GetTerms(ar, "numeric", true);
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (InvalidOperationException expected)
+#pragma warning restore 168
             {
             }
 
@@ -708,7 +722,9 @@ namespace Lucene.Net.Search
                 FieldCache.DEFAULT.GetTermsIndex(ar, "numeric");
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (InvalidOperationException expected)
+#pragma warning restore 168
             {
             }
 
@@ -717,7 +733,9 @@ namespace Lucene.Net.Search
                 FieldCache.DEFAULT.GetDocTermOrds(ar, "numeric");
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (InvalidOperationException expected)
+#pragma warning restore 168
             {
             }
 
@@ -726,7 +744,9 @@ namespace Lucene.Net.Search
                 new DocTermOrds(ar, null, "numeric");
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (InvalidOperationException expected)
+#pragma warning restore 168
             {
             }
 
@@ -741,7 +761,9 @@ namespace Lucene.Net.Search
                     FieldCache.DEFAULT.GetInts(ar, "sortedset", false);
                     Assert.Fail();
                 }
+#pragma warning disable 168
                 catch (InvalidOperationException expected)
+#pragma warning restore 168
                 {
                 }
 
@@ -750,7 +772,9 @@ namespace Lucene.Net.Search
                     FieldCache.DEFAULT.GetTerms(ar, "sortedset", true);
                     Assert.Fail();
                 }
+#pragma warning disable 168
                 catch (InvalidOperationException expected)
+#pragma warning restore 168
                 {
                 }
 
@@ -759,7 +783,9 @@ namespace Lucene.Net.Search
                     FieldCache.DEFAULT.GetTermsIndex(ar, "sortedset");
                     Assert.Fail();
                 }
+#pragma warning disable 168
                 catch (InvalidOperationException expected)
+#pragma warning restore 168
                 {
                 }
 
@@ -768,7 +794,9 @@ namespace Lucene.Net.Search
                     new DocTermOrds(ar, null, "sortedset");
                     Assert.Fail();
                 }
+#pragma warning disable 168
                 catch (InvalidOperationException expected)
+#pragma warning restore 168
                 {
                 }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Search/TestFilteredQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestFilteredQuery.cs b/src/Lucene.Net.Tests/core/Search/TestFilteredQuery.cs
index a341acb..9847b9a 100644
--- a/src/Lucene.Net.Tests/core/Search/TestFilteredQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestFilteredQuery.cs
@@ -374,7 +374,9 @@ namespace Lucene.Net.Search
                 new FilteredQuery(null, null);
                 Assert.Fail("Should throw IllegalArgumentException");
             }
+#pragma warning disable 168
             catch (System.ArgumentException iae)
+#pragma warning restore 168
             {
                 // pass
             }
@@ -383,7 +385,9 @@ namespace Lucene.Net.Search
                 new FilteredQuery(new TermQuery(new Term("field", "one")), null);
                 Assert.Fail("Should throw IllegalArgumentException");
             }
+#pragma warning disable 168
             catch (System.ArgumentException iae)
+#pragma warning restore 168
             {
                 // pass
             }
@@ -392,7 +396,9 @@ namespace Lucene.Net.Search
                 new FilteredQuery(null, new PrefixFilter(new Term("field", "o")));
                 Assert.Fail("Should throw IllegalArgumentException");
             }
+#pragma warning disable 168
             catch (System.ArgumentException iae)
+#pragma warning restore 168
             {
                 // pass
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Search/TestFuzzyQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestFuzzyQuery.cs b/src/Lucene.Net.Tests/core/Search/TestFuzzyQuery.cs
index b24ca17..0ead1d4 100644
--- a/src/Lucene.Net.Tests/core/Search/TestFuzzyQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestFuzzyQuery.cs
@@ -368,7 +368,9 @@ namespace Lucene.Net.Search
                 q = new FuzzyQuery(new Term("field", "t"), 3);
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (System.ArgumentException expected)
+#pragma warning restore 168
             {
                 // expected
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Search/TestIndexSearcher.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestIndexSearcher.cs b/src/Lucene.Net.Tests/core/Search/TestIndexSearcher.cs
index d8fef55..d5dce40 100644
--- a/src/Lucene.Net.Tests/core/Search/TestIndexSearcher.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestIndexSearcher.cs
@@ -130,7 +130,9 @@ namespace Lucene.Net.Search
                 s.SearchAfter(new ScoreDoc(r.MaxDoc, 0.54f), new MatchAllDocsQuery(), 10);
                 Assert.Fail("should have hit IllegalArgumentException when searchAfter exceeds
maxDoc");
             }
+#pragma warning disable 168
             catch (System.ArgumentException e)
+#pragma warning restore 168
             {
                 // ok
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Search/TestMultiPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestMultiPhraseQuery.cs b/src/Lucene.Net.Tests/core/Search/TestMultiPhraseQuery.cs
index b11db87..556a7fd 100644
--- a/src/Lucene.Net.Tests/core/Search/TestMultiPhraseQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestMultiPhraseQuery.cs
@@ -142,7 +142,9 @@ namespace Lucene.Net.Search
                 query4.Add(new Term("field2", "foobar"));
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (System.ArgumentException e)
+#pragma warning restore 168
             {
                 // okay, all terms must belong to the same field
             }
@@ -616,7 +618,9 @@ namespace Lucene.Net.Search
                 query.Slop = -2;
                 Assert.Fail("didn't get expected exception");
             }
+#pragma warning disable 168
             catch (System.ArgumentException expected)
+#pragma warning restore 168
             {
                 // expected exception
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Search/TestPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestPhraseQuery.cs b/src/Lucene.Net.Tests/core/Search/TestPhraseQuery.cs
index 7b9c7ae..394bfca 100644
--- a/src/Lucene.Net.Tests/core/Search/TestPhraseQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestPhraseQuery.cs
@@ -747,7 +747,9 @@ namespace Lucene.Net.Search
                 query.Slop = -2;
                 Assert.Fail("didn't get expected exception");
             }
+#pragma warning disable 168
             catch (System.ArgumentException expected)
+#pragma warning restore 168
             {
                 // expected exception
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs b/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
index a0b98c7..1460f52 100644
--- a/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
@@ -313,7 +313,9 @@ namespace Lucene.Net.Search
                 searcherManager.Acquire();
                 Assert.Fail("already closed");
             }
+#pragma warning disable 168
             catch (AlreadyClosedException ex)
+#pragma warning restore 168
             {
                 // expected
             }
@@ -360,7 +362,9 @@ namespace Lucene.Net.Search
                     }
 #if !NETSTANDARD
                 }
+#pragma warning disable 168
                 catch (ThreadInterruptedException e)
+#pragma warning restore 168
                 {
                     //
                 }
@@ -474,7 +478,9 @@ namespace Lucene.Net.Search
                 // this should fail
                 sm.Acquire();
             }
+#pragma warning disable 168
             catch (AlreadyClosedException e)
+#pragma warning restore 168
             {
                 // ok
             }
@@ -484,7 +490,9 @@ namespace Lucene.Net.Search
                 // this should fail
                 sm.MaybeRefresh();
             }
+#pragma warning disable 168
             catch (AlreadyClosedException e)
+#pragma warning restore 168
             {
                 // ok
             }
@@ -550,7 +558,9 @@ namespace Lucene.Net.Search
             {
                 new SearcherManager(dir, theEvilOne);
             }
+#pragma warning disable 168
             catch (InvalidOperationException ise)
+#pragma warning restore 168
             {
                 // expected
             }
@@ -558,7 +568,9 @@ namespace Lucene.Net.Search
             {
                 new SearcherManager(w.w, random.NextBoolean(), theEvilOne);
             }
+#pragma warning disable 168
             catch (InvalidOperationException ise)
+#pragma warning restore 168
             {
                 // expected
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Search/TestTimeLimitingCollector.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestTimeLimitingCollector.cs b/src/Lucene.Net.Tests/core/Search/TestTimeLimitingCollector.cs
index 27d44b5..f500ce2 100644
--- a/src/Lucene.Net.Tests/core/Search/TestTimeLimitingCollector.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestTimeLimitingCollector.cs
@@ -413,7 +413,9 @@ namespace Lucene.Net.Search
                         throw;
                     }
 #else
+#pragma warning disable 168
                     catch (ThreadInterruptedException ie)
+#pragma warning restore 168
                     {
                         throw;
                     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Store/TestBufferedIndexInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestBufferedIndexInput.cs b/src/Lucene.Net.Tests/core/Store/TestBufferedIndexInput.cs
index 1776390..c82ab20 100644
--- a/src/Lucene.Net.Tests/core/Store/TestBufferedIndexInput.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestBufferedIndexInput.cs
@@ -182,7 +182,9 @@ namespace Lucene.Net.Store
                 CheckReadBytes(input, 11, pos);
                 Assert.Fail("Block read past end of file");
             }
+#pragma warning disable 168
             catch (IOException e)
+#pragma warning restore 168
             {
                 /* success */
             }
@@ -192,7 +194,9 @@ namespace Lucene.Net.Store
                 CheckReadBytes(input, 50, pos);
                 Assert.Fail("Block read past end of file");
             }
+#pragma warning disable 168
             catch (IOException e)
+#pragma warning restore 168
             {
                 /* success */
             }
@@ -202,7 +206,9 @@ namespace Lucene.Net.Store
                 CheckReadBytes(input, 100000, pos);
                 Assert.Fail("Block read past end of file");
             }
+#pragma warning disable 168
             catch (IOException e)
+#pragma warning restore 168
             {
                 /* success */
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestDirectory.cs b/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
index 94161b1..c740945 100644
--- a/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
@@ -47,7 +47,9 @@ namespace Lucene.Net.Store
                     dir.CreateOutput("test", NewIOContext(Random()));
                     Assert.Fail("did not hit expected exception");
                 }
+#pragma warning disable 168
                 catch (AlreadyClosedException ace)
+#pragma warning restore 168
                 {
                 }
             }
@@ -139,7 +141,9 @@ namespace Lucene.Net.Store
                             {
                                 using (IndexInput input = outerBDWrapper.OpenInput(file,
NewIOContext(Random()))) { }
                             }
+#pragma warning disable 168
                             catch (FileNotFoundException fne)
+#pragma warning restore 168
                             {
                             }
                             catch (IOException e)
@@ -240,7 +244,9 @@ namespace Lucene.Net.Store
                     {
                         Assert.IsFalse(lock2.Obtain(1));
                     }
+#pragma warning disable 168
                     catch (LockObtainFailedException e)
+#pragma warning restore 168
                     {
                         // OK
                     }
@@ -348,7 +354,9 @@ namespace Lucene.Net.Store
                     var d = new SimpleFSDirectory(new DirectoryInfo(Path.Combine(path.FullName,
"afile")), null);
                     Assert.Fail("did not hit expected exception");
                 }
+#pragma warning disable 168
                 catch (NoSuchDirectoryException nsde)
+#pragma warning restore 168
                 {
                     // Expected
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Store/TestLock.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestLock.cs b/src/Lucene.Net.Tests/core/Store/TestLock.cs
index eb29149..8067883 100644
--- a/src/Lucene.Net.Tests/core/Store/TestLock.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestLock.cs
@@ -36,7 +36,9 @@ namespace Lucene.Net.Store
                 @lock.Obtain(Lock.LOCK_POLL_INTERVAL);
                 Assert.Fail("Should have failed to obtain lock");
             }
+#pragma warning disable 168
             catch (IOException e)
+#pragma warning restore 168
             {
                 Assert.AreEqual(@lock.LockAttempts, 2, "should attempt to lock more than
once");
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Store/TestLockFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestLockFactory.cs b/src/Lucene.Net.Tests/core/Store/TestLockFactory.cs
index 912529a..ef4d2a1 100644
--- a/src/Lucene.Net.Tests/core/Store/TestLockFactory.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestLockFactory.cs
@@ -129,7 +129,9 @@ namespace Lucene.Net.Store
                 writer2 = new IndexWriter(dir, (new IndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(Random()))).SetOpenMode(OpenMode.APPEND));
                 Assert.Fail("Should have hit an IOException with two IndexWriters on default
SingleInstanceLockFactory");
             }
+#pragma warning disable 168
             catch (IOException e)
+#pragma warning restore 168
             {
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Store/TestMockDirectoryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestMockDirectoryWrapper.cs b/src/Lucene.Net.Tests/core/Store/TestMockDirectoryWrapper.cs
index 6ed0b34..b14ccfb 100644
--- a/src/Lucene.Net.Tests/core/Store/TestMockDirectoryWrapper.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestMockDirectoryWrapper.cs
@@ -82,7 +82,9 @@ namespace Lucene.Net.Store
                 @out.WriteBytes(bytes, bytes.Length);
                 Assert.Fail("should have failed on disk full");
             }
+#pragma warning disable 168
             catch (IOException e)
+#pragma warning restore 168
             {
                 // expected
             }
@@ -102,7 +104,9 @@ namespace Lucene.Net.Store
                 @out.CopyBytes(new ByteArrayDataInput(bytes), bytes.Length);
                 Assert.Fail("should have failed on disk full");
             }
+#pragma warning disable 168
             catch (IOException e)
+#pragma warning restore 168
             {
                 // expected
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Store/TestMultiMMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestMultiMMap.cs b/src/Lucene.Net.Tests/core/Store/TestMultiMMap.cs
index 22bec27..6e609c3 100644
--- a/src/Lucene.Net.Tests/core/Store/TestMultiMMap.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestMultiMMap.cs
@@ -75,7 +75,9 @@ namespace Lucene.Net.Store
                 one.ReadVInt();
                 Assert.Fail("Must throw AlreadyClosedException");
             }
+#pragma warning disable 168
             catch (AlreadyClosedException ignore)
+#pragma warning restore 168
             {
                 // pass
             }
@@ -84,7 +86,9 @@ namespace Lucene.Net.Store
                 two.ReadVInt();
                 Assert.Fail("Must throw AlreadyClosedException");
             }
+#pragma warning disable 168
             catch (AlreadyClosedException ignore)
+#pragma warning restore 168
             {
                 // pass
             }
@@ -93,7 +97,9 @@ namespace Lucene.Net.Store
                 three.ReadVInt();
                 Assert.Fail("Must throw AlreadyClosedException");
             }
+#pragma warning disable 168
             catch (AlreadyClosedException ignore)
+#pragma warning restore 168
             {
                 // pass
             }
@@ -121,7 +127,9 @@ namespace Lucene.Net.Store
                 two.ReadVInt();
                 Assert.Fail("Must throw AlreadyClosedException");
             }
+#pragma warning disable 168
             catch (AlreadyClosedException ignore)
+#pragma warning restore 168
             {
                 // pass
             }
@@ -150,7 +158,9 @@ namespace Lucene.Net.Store
                 one.ReadInt();
                 Assert.Fail("Must throw AlreadyClosedException");
             }
+#pragma warning disable 168
             catch (AlreadyClosedException ignore)
+#pragma warning restore 168
             {
                 // pass
             }
@@ -159,7 +169,9 @@ namespace Lucene.Net.Store
                 two.ReadInt();
                 Assert.Fail("Must throw AlreadyClosedException");
             }
+#pragma warning disable 168
             catch (AlreadyClosedException ignore)
+#pragma warning restore 168
             {
                 // pass
             }
@@ -168,7 +180,9 @@ namespace Lucene.Net.Store
                 three.ReadInt();
                 Assert.Fail("Must throw AlreadyClosedException");
             }
+#pragma warning disable 168
             catch (AlreadyClosedException ignore)
+#pragma warning restore 168
             {
                 // pass
             }
@@ -177,7 +191,9 @@ namespace Lucene.Net.Store
                 four.ReadInt();
                 Assert.Fail("Must throw AlreadyClosedException");
             }
+#pragma warning disable 168
             catch (AlreadyClosedException ignore)
+#pragma warning restore 168
             {
                 // pass
             }
@@ -207,7 +223,9 @@ namespace Lucene.Net.Store
                 one.ReadInt();
                 Assert.Fail("Must throw AlreadyClosedException");
             }
+#pragma warning disable 168
             catch (AlreadyClosedException ignore)
+#pragma warning restore 168
             {
                 // pass
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Support/TestDataInputStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Support/TestDataInputStream.cs b/src/Lucene.Net.Tests/core/Support/TestDataInputStream.cs
index 769319d..cef37ed 100644
--- a/src/Lucene.Net.Tests/core/Support/TestDataInputStream.cs
+++ b/src/Lucene.Net.Tests/core/Support/TestDataInputStream.cs
@@ -191,11 +191,15 @@ namespace Lucene.Net.Support
                     fail("DataInputStream.skipBytes does not return expected value");
                 }
             }
+#pragma warning disable 168
             catch (EndOfStreamException e)
+#pragma warning restore 168
             {
                 fail("DataInputStream.skipBytes throws unexpected EOFException");
             }
+#pragma warning disable 168
             catch (IOException e)
+#pragma warning restore 168
             {
                 Console.WriteLine("IOException is thrown - possible result");
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/TestWorstCaseTestBehavior.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/TestWorstCaseTestBehavior.cs b/src/Lucene.Net.Tests/core/TestWorstCaseTestBehavior.cs
index ee0a0b9..709990f 100644
--- a/src/Lucene.Net.Tests/core/TestWorstCaseTestBehavior.cs
+++ b/src/Lucene.Net.Tests/core/TestWorstCaseTestBehavior.cs
@@ -55,7 +55,9 @@ namespace Lucene.Net
                 {
                     Thread.Sleep(10000);
                 }
+#pragma warning disable 168
                 catch (ThreadInterruptedException e)
+#pragma warning restore 168
                 {
                     // Ignore.
                 }
@@ -137,7 +139,9 @@ namespace Lucene.Net
                 {
                     Thread.Sleep(1000);
                 }
+#pragma warning disable 168
                 catch (ThreadInterruptedException e)
+#pragma warning restore 168
                 {
                 }
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
index dd62a80..2e36a9c 100644
--- a/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
+++ b/src/Lucene.Net.Tests/core/Util/Fst/TestFSTs.cs
@@ -393,7 +393,9 @@ namespace Lucene.Net.Util.Fst
                         {
                             var _ = termsEnum.Ord;
                         }
+#pragma warning disable 168
                         catch (System.NotSupportedException uoe)
+#pragma warning restore 168
                         {
                             if (VERBOSE)
                             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs b/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
index b35a97e..8527887 100644
--- a/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
+++ b/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
@@ -516,7 +516,9 @@ namespace Lucene.Net.Util.Packed
             {
                 p64 = new Packed64(INDEX, BITS);
             }
+#pragma warning disable 168
             catch (System.OutOfMemoryException oome)
+#pragma warning restore 168
             {
                 // this can easily happen: we're allocating a
                 // long[] that needs 256-273 MB.  Heap is 512 MB,
@@ -536,7 +538,9 @@ namespace Lucene.Net.Util.Packed
             {
                 p64sb = Packed64SingleBlock.Create(INDEX, BITS);
             }
+#pragma warning disable 168
             catch (System.OutOfMemoryException oome)
+#pragma warning restore 168
             {
                 // Ignore: see comment above
             }
@@ -552,7 +556,9 @@ namespace Lucene.Net.Util.Packed
             {
                 p8 = new Packed8ThreeBlocks(index);
             }
+#pragma warning disable 168
             catch (System.OutOfMemoryException oome)
+#pragma warning restore 168
             {
                 // Ignore: see comment above
             }
@@ -569,7 +575,9 @@ namespace Lucene.Net.Util.Packed
             {
                 p16 = new Packed16ThreeBlocks(index);
             }
+#pragma warning disable 168
             catch (System.OutOfMemoryException oome)
+#pragma warning restore 168
             {
                 // Ignore: see comment above
             }
@@ -1369,7 +1377,9 @@ namespace Lucene.Net.Util.Packed
                     it.Next();
                     Assert.IsTrue(false);
                 }
+#pragma warning disable 168
                 catch (IOException e)
+#pragma warning restore 168
                 {
                     // OK
                 }
@@ -1406,7 +1416,9 @@ namespace Lucene.Net.Util.Packed
                     it2.Skip(1);
                     Assert.IsTrue(false);
                 }
+#pragma warning disable 168
                 catch (IOException e)
+#pragma warning restore 168
                 {
                     // OK
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/StressRamUsageEstimator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/StressRamUsageEstimator.cs b/src/Lucene.Net.Tests/core/Util/StressRamUsageEstimator.cs
index 3f8249e..e685091 100644
--- a/src/Lucene.Net.Tests/core/Util/StressRamUsageEstimator.cs
+++ b/src/Lucene.Net.Tests/core/Util/StressRamUsageEstimator.cs
@@ -68,7 +68,9 @@ namespace Lucene.Net.Util
                     }
                 }
             }
+#pragma warning disable 168
             catch (System.OutOfMemoryException e)
+#pragma warning restore 168
             {
                 // Release and quit.
             }
@@ -152,7 +154,9 @@ namespace Lucene.Net.Util
                     }
                 }
             }
+#pragma warning disable 168
             catch (System.OutOfMemoryException e)
+#pragma warning restore 168
             {
                 // Release and quit.
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/TestArrayUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestArrayUtil.cs b/src/Lucene.Net.Tests/core/Util/TestArrayUtil.cs
index f7bb029..0b0c27c 100644
--- a/src/Lucene.Net.Tests/core/Util/TestArrayUtil.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestArrayUtil.cs
@@ -81,7 +81,9 @@ namespace Lucene.Net.Util
                 test = ArrayUtil.ParseInt("".ToCharArray());
                 Assert.IsTrue(false);
             }
+#pragma warning disable 168
             catch (FormatException e)
+#pragma warning restore 168
             {
                 //expected
             }
@@ -90,7 +92,9 @@ namespace Lucene.Net.Util
                 test = ArrayUtil.ParseInt("foo".ToCharArray());
                 Assert.IsTrue(false);
             }
+#pragma warning disable 168
             catch (FormatException e)
+#pragma warning restore 168
             {
                 //expected
             }
@@ -99,7 +103,9 @@ namespace Lucene.Net.Util
                 test = ArrayUtil.ParseInt(Convert.ToString(long.MaxValue).ToCharArray());
                 Assert.IsTrue(false);
             }
+#pragma warning disable 168
             catch (FormatException e)
+#pragma warning restore 168
             {
                 //expected
             }
@@ -108,7 +114,9 @@ namespace Lucene.Net.Util
                 test = ArrayUtil.ParseInt("0.34".ToCharArray());
                 Assert.IsTrue(false);
             }
+#pragma warning disable 168
             catch (FormatException e)
+#pragma warning restore 168
             {
                 //expected
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/TestAttributeSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestAttributeSource.cs b/src/Lucene.Net.Tests/core/Util/TestAttributeSource.cs
index 6c45e34..f4a0c43 100644
--- a/src/Lucene.Net.Tests/core/Util/TestAttributeSource.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestAttributeSource.cs
@@ -80,7 +80,9 @@ namespace Lucene.Net.Util
                 src3.RestoreState(state);
                 Assert.Fail("The third instance is missing the TypeAttribute, so restoreState()
should throw IllegalArgumentException");
             }
+#pragma warning disable 168
             catch (System.ArgumentException iae)
+#pragma warning restore 168
             {
                 // pass
             }
@@ -145,7 +147,9 @@ namespace Lucene.Net.Util
                 src.AddAttribute<Token>();
                 Assert.Fail("Should throw IllegalArgumentException");
             }
+#pragma warning disable 168
             catch (System.ArgumentException iae)
+#pragma warning restore 168
             {
             }
 
@@ -155,10 +159,14 @@ namespace Lucene.Net.Util
                 src.AddAttribute<Token>();
                 Assert.Fail("Should throw IllegalArgumentException");
             }
+#pragma warning disable 168
             catch (System.ArgumentException iae)
+#pragma warning restore 168
             {
             }
 
+            // LUCENENET TODO: Finish implementation
+
             /*try
             {
               AttributeSource src = new AttributeSource();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/TestCharsRef.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestCharsRef.cs b/src/Lucene.Net.Tests/core/Util/TestCharsRef.cs
index 76f3a3c..dda066f 100644
--- a/src/Lucene.Net.Tests/core/Util/TestCharsRef.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestCharsRef.cs
@@ -159,7 +159,9 @@ namespace Lucene.Net.Util
                 var _ = c[-1];
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (System.IndexOutOfRangeException expected)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -169,7 +171,9 @@ namespace Lucene.Net.Util
                 var _ = c[3];
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (System.IndexOutOfRangeException expected)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -204,7 +208,9 @@ namespace Lucene.Net.Util
                 c.SubSequence(-1, 1);
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (System.IndexOutOfRangeException expected)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -214,7 +220,9 @@ namespace Lucene.Net.Util
                 c.SubSequence(0, -1);
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (System.IndexOutOfRangeException expected)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -224,7 +232,9 @@ namespace Lucene.Net.Util
                 c.SubSequence(0, 4);
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (System.IndexOutOfRangeException expected)
+#pragma warning restore 168
             {
                 // expected exception
             }
@@ -234,7 +244,9 @@ namespace Lucene.Net.Util
                 c.SubSequence(2, 1);
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (System.IndexOutOfRangeException expected)
+#pragma warning restore 168
             {
                 // expected exception
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/TestIOUtils.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestIOUtils.cs b/src/Lucene.Net.Tests/core/Util/TestIOUtils.cs
index 2682431..e15d5ac 100644
--- a/src/Lucene.Net.Tests/core/Util/TestIOUtils.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestIOUtils.cs
@@ -63,7 +63,9 @@ namespace Lucene.Net.Util
                 Assert.IsTrue(e1.Data.Contains("SuppressedExceptions"));
                 Assert.IsTrue(((List<Exception>) e1.Data["SuppressedExceptions"]).Count
== 2);
             }
+#pragma warning disable 168
             catch (Exception e2)
+#pragma warning restore 168
             {
                 Assert.Fail("Exception should not be thrown here");
             }
@@ -78,7 +80,9 @@ namespace Lucene.Net.Util
                 Assert.IsTrue(e1.Data.Contains("SuppressedExceptions"));
                 Assert.IsTrue(((List<Exception>)e1.Data["SuppressedExceptions"]).Count
== 1);
             }
+#pragma warning disable 168
             catch (Exception e2)
+#pragma warning restore 168
             {
                 Assert.Fail("Exception should not be thrown here");
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/TestNamedSPILoader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestNamedSPILoader.cs b/src/Lucene.Net.Tests/core/Util/TestNamedSPILoader.cs
index 5d42841..b9f1697 100644
--- a/src/Lucene.Net.Tests/core/Util/TestNamedSPILoader.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestNamedSPILoader.cs
@@ -43,7 +43,9 @@ namespace Lucene.Net.Util
                 Codec.ForName("dskfdskfsdfksdfdsf");
                 Assert.Fail();
             }
+#pragma warning disable 168
             catch (System.ArgumentException expected)
+#pragma warning restore 168
             {
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/TestNumericUtils.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestNumericUtils.cs b/src/Lucene.Net.Tests/core/Util/TestNumericUtils.cs
index 9b6c329..45614c2 100644
--- a/src/Lucene.Net.Tests/core/Util/TestNumericUtils.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestNumericUtils.cs
@@ -91,7 +91,9 @@ namespace Lucene.Net.Util
                     NumericUtils.PrefixCodedToInt(prefixVals[i]);
                     Assert.Fail("decoding a prefix coded long value as int should fail");
                 }
+#pragma warning disable 168
                 catch (FormatException e)
+#pragma warning restore 168
                 {
                     // worked
                 }
@@ -137,7 +139,9 @@ namespace Lucene.Net.Util
                     NumericUtils.PrefixCodedToLong(prefixVals[i]);
                     Assert.Fail("decoding a prefix coded int value as long should fail");
                 }
+#pragma warning disable 168
                 catch (FormatException e)
+#pragma warning restore 168
                 {
                     // worked
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/TestOfflineSorter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestOfflineSorter.cs b/src/Lucene.Net.Tests/core/Util/TestOfflineSorter.cs
index 3bb0c0c..022bfd3 100644
--- a/src/Lucene.Net.Tests/core/Util/TestOfflineSorter.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestOfflineSorter.cs
@@ -223,7 +223,9 @@ namespace Lucene.Net.Util
                 OfflineSorter.BufferSize.Megabytes(2048);
                 Assert.Fail("max mb is 2047");
             }
+#pragma warning disable 168
             catch (System.ArgumentException e)
+#pragma warning restore 168
             {
             }
 
@@ -232,7 +234,9 @@ namespace Lucene.Net.Util
                 OfflineSorter.BufferSize.Megabytes(0);
                 Assert.Fail("min mb is 0.5");
             }
+#pragma warning disable 168
             catch (System.ArgumentException e)
+#pragma warning restore 168
             {
             }
 
@@ -241,7 +245,9 @@ namespace Lucene.Net.Util
                 OfflineSorter.BufferSize.Megabytes(-1);
                 Assert.Fail("min mb is 0.5");
             }
+#pragma warning disable 168
             catch (System.ArgumentException e)
+#pragma warning restore 168
             {
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/TestRamUsageEstimatorOnWildAnimals.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestRamUsageEstimatorOnWildAnimals.cs b/src/Lucene.Net.Tests/core/Util/TestRamUsageEstimatorOnWildAnimals.cs
index ad73e91..610f6cf 100644
--- a/src/Lucene.Net.Tests/core/Util/TestRamUsageEstimatorOnWildAnimals.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestRamUsageEstimatorOnWildAnimals.cs
@@ -52,7 +52,9 @@ namespace Lucene.Net.Util
                     RamUsageEstimator.SizeOf(first); // cause SOE or pass.
                     lower = mid;
                 }
+#pragma warning disable 168
                 catch (System.StackOverflowException e)
+#pragma warning restore 168
                 {
                     upper = mid;
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/TestUnicodeUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestUnicodeUtil.cs b/src/Lucene.Net.Tests/core/Util/TestUnicodeUtil.cs
index e433f8b..ef7314e 100644
--- a/src/Lucene.Net.Tests/core/Util/TestUnicodeUtil.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestUnicodeUtil.cs
@@ -145,7 +145,9 @@ namespace Lucene.Net.Util
             {
                 UnicodeUtil.CodePointCount(new BytesRef(bytes));
             }
+#pragma warning disable 168
             catch (System.ArgumentException e)
+#pragma warning restore 168
             {
                 threwAssertion = true;
             }
@@ -216,11 +218,15 @@ namespace Lucene.Net.Util
                     Assert.AreEqual(cpString.Substring(rs, rc), str);
                     continue;
                 }
+#pragma warning disable 168
                 catch (System.IndexOutOfRangeException e1)
+#pragma warning restore 168
                 {
                     // Ignored.
                 }
+#pragma warning disable 168
                 catch (System.ArgumentException e2)
+#pragma warning restore 168
                 {
                     // Ignored.
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/TestVirtualMethod.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestVirtualMethod.cs b/src/Lucene.Net.Tests/core/Util/TestVirtualMethod.cs
index 30c8b00..81c8325 100644
--- a/src/Lucene.Net.Tests/core/Util/TestVirtualMethod.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestVirtualMethod.cs
@@ -114,7 +114,9 @@ namespace Lucene.Net.Util
                 PublicTestMethod.GetImplementationDistance(typeof(LuceneTestCase));
                 Assert.Fail("LuceneTestCase is not a subclass and can never override publicTest(String)");
             }
+#pragma warning disable 168
             catch (System.ArgumentException arg)
+#pragma warning restore 168
             {
                 // pass
             }
@@ -124,7 +126,9 @@ namespace Lucene.Net.Util
                 new VirtualMethod(typeof(BaseTestVirtualMethod), "bogus");
                 Assert.Fail("Method bogus() does not exist, so IAE should be thrown");
             }
+#pragma warning disable 168
             catch (System.ArgumentException arg)
+#pragma warning restore 168
             {
                 // pass
             }
@@ -133,7 +137,9 @@ namespace Lucene.Net.Util
             {
                 new VirtualMethod(typeof(TestClass2), "PublicTest", typeof(string));
             }
+#pragma warning disable 168
             catch (System.ArgumentException arg)
+#pragma warning restore 168
             {
                 Assert.Fail("Method publicTest(String) is declared in TestClass2, so IAE
should not be thrown");
             }
@@ -144,7 +150,9 @@ namespace Lucene.Net.Util
                 new VirtualMethod(typeof(BaseTestVirtualMethod), "PublicTest", typeof(string));
                 Assert.Fail("Violating singleton status succeeded");
             }
+#pragma warning disable 168
             catch (System.ArgumentException arg)
+#pragma warning restore 168
             {
                 // pass
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/86686bf7/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs b/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs
index 2b2c0e4..38da482 100644
--- a/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs
@@ -154,7 +154,9 @@ namespace Lucene.Net.Util
                     size = newSize;
 #if !NETSTANDARD
                 }
+#pragma warning disable 168
                 catch (ThreadInterruptedException ie)
+#pragma warning restore 168
                 {
                 }
 #endif
@@ -267,7 +269,9 @@ namespace Lucene.Net.Util
                     size = newSize;
 #if !NETSTANDARD
                 }
+#pragma warning disable 168
                 catch (ThreadInterruptedException ie)
+#pragma warning restore 168
                 {
                 }
 #endif


Mime
View raw message