You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2019/08/07 22:26:37 UTC
[lucenenet] 40/42: SWEEP: CA2200: Rethrow to preserve stack details
(https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
(as per LUCENENET-435)
This is an automated email from the ASF dual-hosted git repository.
nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit 6b4bf3f09e2edb81b6baf0e6394920a57047bc57
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Aug 7 11:38:08 2019 +0700
SWEEP: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details) (as per LUCENENET-435)
---
.../Analysis/Synonym/FSTSynonymFilterFactory.cs | 6 ++--
.../Analysis/Synonym/SlowSynonymFilterFactory.cs | 4 +--
.../ByTask/Feeds/EnwikiContentSource.cs | 4 +--
.../ByTask/Tasks/AnalyzerFactoryTask.cs | 4 +--
.../ByTask/Tasks/NewAnalyzerTask.cs | 2 +-
.../Analysis/BaseTokenStreamTestCase.cs | 4 +--
.../Index/AssertingAtomicReader.cs | 4 +--
.../Index/BaseDocValuesFormatTestCase.cs | 4 +--
.../Store/SlowOpeningMockIndexInputWrapper.cs | 5 ++--
.../Util/LuceneTestCase.cs | 4 +--
.../Util/TestRuleSetupAndRestoreClassEnv.cs | 2 +-
.../CharFilters/HTMLStripCharFilterTest.cs | 2 +-
.../Analysis/Core/TestAllAnalyzersHaveFactories.cs | 6 ++--
.../Analysis/Core/TestRandomChains.cs | 30 ++++++++++----------
.../Util/BaseTokenStreamFactoryTestCase.cs | 2 +-
.../Collation/TestICUCollationKeyFilterFactory.cs | 2 +-
.../Spell/TestWordBreakSpellChecker.cs | 24 ++++++++--------
src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs | 8 +++---
.../Index/TestDocumentsWriterStallControl.cs | 12 ++++----
src/Lucene.Net.Tests/Index/TestIndexWriter.cs | 4 +--
.../Index/TestIndexWriterExceptions.cs | 2 +-
src/Lucene.Net.Tests/Index/TestStressIndexing2.cs | 8 +++---
src/Lucene.Net.Tests/Index/TestTransactions.cs | 2 +-
.../Search/TestDisjunctionMaxQuery.cs | 32 +++++++++++-----------
.../Util/Automaton/TestBasicOperations.cs | 4 +--
.../Util/Automaton/TestUTF32ToUTF8.cs | 4 +--
src/Lucene.Net/Index/IndexFileDeleter.cs | 4 +--
src/Lucene.Net/Index/IndexWriter.cs | 10 ++++---
src/Lucene.Net/Index/SegmentInfos.cs | 2 +-
src/Lucene.Net/Search/IndexSearcher.cs | 5 ++--
src/Lucene.Net/Store/FileSwitchDirectory.cs | 4 +--
src/Lucene.Net/Store/NRTCachingDirectory.cs | 4 +--
32 files changed, 110 insertions(+), 104 deletions(-)
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs
index 46c78a9..20ca003 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs
@@ -134,7 +134,7 @@ namespace Lucene.Net.Analysis.Synonym
}
catch (Exception e)
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
if (File.Exists(synonyms))
@@ -166,9 +166,9 @@ namespace Lucene.Net.Analysis.Synonym
}
return tokFactory;
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
}
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilterFactory.cs
index 691b794..5c81a8e 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilterFactory.cs
@@ -212,9 +212,9 @@ namespace Lucene.Net.Analysis.Synonym
}
return tokFactory;
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiContentSource.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiContentSource.cs
index c310c2d..bc72b18 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiContentSource.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiContentSource.cs
@@ -209,7 +209,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds
// To work around a bug in XERCES (XERCESJ-1257), we assume the XML is always UTF8, so we simply provide reader.
reader.Parse(new InputSource(IOUtils.GetDecodingReader(localFileIS, Encoding.UTF8)));
}
- catch (IOException ioe)
+ catch (IOException /*ioe*/)
{
lock (outerInstance)
{
@@ -219,7 +219,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds
}
else
// Exception is real
- throw ioe;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
}
diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs
index 3f0f60d..b428a52 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs
@@ -348,7 +348,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
{
if (e.Message.StartsWith("Line #", StringComparison.Ordinal))
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
else
{
@@ -503,7 +503,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
{
if (e.Message.StartsWith("Line #", StringComparison.Ordinal))
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
else
{
diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/NewAnalyzerTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/NewAnalyzerTask.cs
index 37263fc..0549872 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Tasks/NewAnalyzerTask.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/NewAnalyzerTask.cs
@@ -171,7 +171,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
{
if (e.Message.StartsWith("Line #", StringComparison.Ordinal))
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
else
{
diff --git a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
index 9e5870e..7abbe04 100644
--- a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
@@ -1065,7 +1065,7 @@ namespace Lucene.Net.Analysis
}
else
{
- throw ae;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
finally
@@ -1104,7 +1104,7 @@ namespace Lucene.Net.Analysis
}
else
{
- throw ae;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
finally
diff --git a/src/Lucene.Net.TestFramework/Index/AssertingAtomicReader.cs b/src/Lucene.Net.TestFramework/Index/AssertingAtomicReader.cs
index 4e6d7d6..f623206 100644
--- a/src/Lucene.Net.TestFramework/Index/AssertingAtomicReader.cs
+++ b/src/Lucene.Net.TestFramework/Index/AssertingAtomicReader.cs
@@ -289,11 +289,11 @@ namespace Lucene.Net.Index
int docid = @in.DocID;
Debug.Assert(docid == -1, @in.GetType() + ": invalid initial doc id: " + docid);
}
- catch (System.NotSupportedException e)
+ catch (System.NotSupportedException /*e*/)
{
if (failOnUnsupportedDocID)
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
Doc = -1;
diff --git a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
index 804acd7..fb60fac 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
@@ -3019,7 +3019,7 @@ namespace Lucene.Net.Index
{
if (iae.Message.IndexOf("is too large", StringComparison.Ordinal) == -1)
{
- throw iae;
+ throw /*iae*/; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
else
{
@@ -3041,7 +3041,7 @@ namespace Lucene.Net.Index
{
if (iae.Message.IndexOf("is too large", StringComparison.Ordinal) == -1)
{
- throw iae;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
else
{
diff --git a/src/Lucene.Net.TestFramework/Store/SlowOpeningMockIndexInputWrapper.cs b/src/Lucene.Net.TestFramework/Store/SlowOpeningMockIndexInputWrapper.cs
index 6604404..ed674bc 100644
--- a/src/Lucene.Net.TestFramework/Store/SlowOpeningMockIndexInputWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/SlowOpeningMockIndexInputWrapper.cs
@@ -36,7 +36,7 @@ namespace Lucene.Net.Store
Thread.Sleep(50);
#if !NETSTANDARD1_6
}
- catch (ThreadInterruptedException ie)
+ catch (ThreadInterruptedException /*ie*/)
{
try
{
@@ -45,7 +45,8 @@ namespace Lucene.Net.Store
catch (Exception)
{
}
- throw new ThreadInterruptedException(ie.ToString(), ie);
+ //throw new ThreadInterruptedException(ie.ToString(), ie);
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
#endif
}
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 8db12de..45eb5a4 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -801,10 +801,10 @@ namespace Lucene.Net.Util
{
insanity = FieldCacheSanityChecker.CheckSanity(entries);
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
DumpArray(msg + ": FieldCache", entries, Console.Error);
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
Assert.AreEqual(0, insanity.Length, msg + ": Insane FieldCache usage(s) found");
diff --git a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
index 08e9fc8..a95307b 100644
--- a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
@@ -279,7 +279,7 @@ namespace Lucene.Net.Util
catch (Exception e)
{
Console.Error.WriteLine("NOTE: " + e.Message + " Suppressed codecs: " + Arrays.ToString(avoidCodecs.ToArray()));
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/HTMLStripCharFilterTest.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/HTMLStripCharFilterTest.cs
index ea10176..9a63597 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/HTMLStripCharFilterTest.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/HTMLStripCharFilterTest.cs
@@ -723,7 +723,7 @@ namespace Lucene.Net.Analysis.CharFilters
{
if (gold.Equals(builder.ToString(), StringComparison.Ordinal))
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
throw new Exception("('" + builder.ToString() + "' is not equal to '" + gold + "'). " + e.Message, e);
}
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestAllAnalyzersHaveFactories.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestAllAnalyzersHaveFactories.cs
index a58f316..d2c157f 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestAllAnalyzersHaveFactories.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestAllAnalyzersHaveFactories.cs
@@ -114,7 +114,7 @@ namespace Lucene.Net.Analysis.Core
if (e.InnerException is MissingMethodException)
{
// there is no corresponding ctor available
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
// TODO: For now pass because some factories have not yet a default config that always works
}
@@ -146,7 +146,7 @@ namespace Lucene.Net.Analysis.Core
if (e.InnerException is MissingMethodException)
{
// there is no corresponding ctor available
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
// TODO: For now pass because some factories have not yet a default config that always works
}
@@ -178,7 +178,7 @@ namespace Lucene.Net.Analysis.Core
if (e.InnerException is MissingMethodException)
{
// there is no corresponding ctor available
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
// TODO: For now pass because some factories have not yet a default config that always works
}
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
index d9f4a54..efa857b 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
@@ -525,9 +525,9 @@ namespace Lucene.Net.Analysis.Core
{
return new Dictionary(affixStream, dictStream);
}
- catch (Exception ex)
+ catch (Exception /*ex*/)
{
- throw ex;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
#pragma warning disable 162
return null; // unreachable code
#pragma warning restore 162
@@ -574,9 +574,9 @@ namespace Lucene.Net.Analysis.Core
return hyphenator;
}
}
- catch (Exception ex)
+ catch (Exception /*ex*/)
{
- throw ex;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
#pragma warning disable 162
return null; // unreachable code
#pragma warning restore 162
@@ -594,9 +594,9 @@ namespace Lucene.Net.Analysis.Core
Type clazz = Type.GetType("Lucene.Net.Tartarus.Snowball.Ext." + lang + "Stemmer, Lucene.Net.Analysis.Common");
return clazz.GetConstructor(new Type[0]).Invoke(new object[0]);
}
- catch (Exception ex)
+ catch (Exception /*ex*/)
{
- throw ex;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
#pragma warning disable 162
return null; // unreachable code
#pragma warning restore 162
@@ -700,9 +700,9 @@ namespace Lucene.Net.Analysis.Core
{
return builder.Build();
}
- catch (Exception ex)
+ catch (Exception /*ex*/)
{
- throw ex;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
#pragma warning disable 162
return null; // unreachable code
#pragma warning restore 162
@@ -724,9 +724,9 @@ namespace Lucene.Net.Analysis.Core
{
return b.Build();
}
- catch (Exception ex)
+ catch (Exception /*ex*/)
{
- throw ex;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
#pragma warning disable 162
return null; // unreachable code
#pragma warning restore 162
@@ -927,7 +927,7 @@ namespace Lucene.Net.Analysis.Core
}
else
{
- throw ite;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
//catch (IllegalAccessException iae)
@@ -1167,10 +1167,10 @@ namespace Lucene.Net.Analysis.Core
CheckRandomData(random, a, 500 * RANDOM_MULTIPLIER, 20, false,
false /* We already validate our own offsets... */);
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
Console.WriteLine("Exception from random analyzer: " + a);
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
}
@@ -1193,10 +1193,10 @@ namespace Lucene.Net.Analysis.Core
CheckRandomData(random, a, 50 * RANDOM_MULTIPLIER, 128, false,
false /* We already validate our own offsets... */);
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
Console.WriteLine("Exception from random analyzer: " + a);
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
}
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/BaseTokenStreamFactoryTestCase.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/BaseTokenStreamFactoryTestCase.cs
index 7924089..b23571b 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/BaseTokenStreamFactoryTestCase.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/BaseTokenStreamFactoryTestCase.cs
@@ -83,7 +83,7 @@ namespace Lucene.Net.Analysis.Util
}
else
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
if (factory is IResourceLoaderAware)
diff --git a/src/Lucene.Net.Tests.Analysis.ICU/Collation/TestICUCollationKeyFilterFactory.cs b/src/Lucene.Net.Tests.Analysis.ICU/Collation/TestICUCollationKeyFilterFactory.cs
index 93c3b81..fce10cd 100644
--- a/src/Lucene.Net.Tests.Analysis.ICU/Collation/TestICUCollationKeyFilterFactory.cs
+++ b/src/Lucene.Net.Tests.Analysis.ICU/Collation/TestICUCollationKeyFilterFactory.cs
@@ -332,7 +332,7 @@ namespace Lucene.Net.Collation
}
else
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
if (factory is IResourceLoaderAware)
diff --git a/src/Lucene.Net.Tests.Suggest/Spell/TestWordBreakSpellChecker.cs b/src/Lucene.Net.Tests.Suggest/Spell/TestWordBreakSpellChecker.cs
index fd1e2e4..ede9113 100644
--- a/src/Lucene.Net.Tests.Suggest/Spell/TestWordBreakSpellChecker.cs
+++ b/src/Lucene.Net.Tests.Suggest/Spell/TestWordBreakSpellChecker.cs
@@ -151,10 +151,10 @@ namespace Lucene.Net.Search.Spell
assertTrue(cs[1].Suggestion.String.Equals("hundredeight", StringComparison.Ordinal));
}
}
- catch (Exception e)
- {
- throw e;
- }
+ //catch (Exception e) // LUCENENET: Senseless to catch and rethrow here
+ //{
+ // throw e;
+ //}
finally
{
try { ir.Dispose(); } catch (Exception /*e1*/) { }
@@ -263,10 +263,10 @@ namespace Lucene.Net.Search.Spell
}
}
- catch (Exception e)
- {
- throw e;
- }
+ //catch (Exception e) // LUCENENET: Senseless to catch and rethrow here
+ //{
+ // throw e;
+ //}
finally
{
try { ir.Dispose(); } catch (Exception /*e1*/) { }
@@ -372,10 +372,10 @@ namespace Lucene.Net.Search.Spell
}
}
- catch (Exception e)
- {
- throw e;
- }
+ //catch (Exception e) // LUCENENET: Senseless to catch and rethrow here
+ //{
+ // throw e;
+ //}
finally
{
try
diff --git a/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs b/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs
index b501f56..ee98482 100644
--- a/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs
+++ b/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs
@@ -645,11 +645,11 @@ namespace Lucene.Net.Index
Assert.Fail("should have failed on commits prior to last " + N);
}
}
- catch (IOException e)
+ catch (IOException /*e*/)
{
if (i != N)
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
if (i < N)
@@ -765,11 +765,11 @@ namespace Lucene.Net.Index
Assert.Fail("should have failed on commits before last " + N);
}
}
- catch (IOException e)
+ catch (IOException /*e*/)
{
if (i != N)
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
if (i < N)
diff --git a/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs b/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs
index ade3e46..67a0f17 100644
--- a/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs
@@ -271,10 +271,11 @@ namespace Lucene.Net.Index
Assert.IsTrue(Sync.await());
#if !NETSTANDARD1_6
}
- catch (ThreadInterruptedException e)
+ catch (ThreadInterruptedException /*e*/)
{
Console.WriteLine("[Waiter] got interrupted - wait count: " + Sync.Waiter.CurrentCount);
- throw new ThreadInterruptedException("Thread Interrupted Exception", e);
+ //throw new ThreadInterruptedException("Thread Interrupted Exception", e);
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
#endif
}
@@ -328,16 +329,17 @@ namespace Lucene.Net.Index
Assert.IsTrue(Sync.await());
}
#if !NETSTANDARD1_6
- catch (ThreadInterruptedException e)
+ catch (ThreadInterruptedException /*e*/)
{
Console.WriteLine("[Updater] got interrupted - wait count: " + Sync.Waiter.CurrentCount);
- throw new ThreadInterruptedException("Thread Interrupted Exception", e);
+ //throw new ThreadInterruptedException("Thread Interrupted Exception", e);
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
#endif
catch (Exception e)
{
Console.Write("signal failed with : " + e);
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
Sync.LeftCheckpoint.Signal();
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
index b99a7cf..ed8f476 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
@@ -2713,14 +2713,14 @@ namespace Lucene.Net.Index
Assert.Fail("expected exception");
}
}
- catch (IOException ioe)
+ catch (IOException /*ioe*/)
{
// OpenMode_e.APPEND should throw an exception since no
// index exists:
if (mode == 0)
{
// Unexpected
- throw ioe;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
index d2373d5..6a0b259 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
@@ -2359,7 +2359,7 @@ namespace Lucene.Net.Index
}
else
{
- throw ioe;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
shouldFail.Set(false);
diff --git a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
index 3a5b77a..b552f7a 100644
--- a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
+++ b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
@@ -442,12 +442,12 @@ namespace Lucene.Net.Index
{
VerifyEquals(r1.Document(id1), r2.Document(id2));
}
- catch (Exception t)
+ catch (Exception /*t*/)
{
Console.WriteLine("FAILED id=" + term + " id1=" + id1 + " id2=" + id2 + " term=" + term);
Console.WriteLine(" d1=" + r1.Document(id1));
Console.WriteLine(" d2=" + r2.Document(id2));
- throw t;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
try
@@ -455,7 +455,7 @@ namespace Lucene.Net.Index
// verify term vectors are equivalent
VerifyEquals(r1.GetTermVectors(id1), r2.GetTermVectors(id2));
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
Console.WriteLine("FAILED id=" + term + " id1=" + id1 + " id2=" + id2);
Fields tv1 = r1.GetTermVectors(id1);
@@ -536,7 +536,7 @@ namespace Lucene.Net.Index
}
}
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
diff --git a/src/Lucene.Net.Tests/Index/TestTransactions.cs b/src/Lucene.Net.Tests/Index/TestTransactions.cs
index acefbbc..2f5b037 100644
--- a/src/Lucene.Net.Tests/Index/TestTransactions.cs
+++ b/src/Lucene.Net.Tests/Index/TestTransactions.cs
@@ -246,7 +246,7 @@ namespace Lucene.Net.Index
{
if (!e.Message.Contains("on purpose"))
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
if (r1 != null)
{
diff --git a/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs b/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs
index 77722c7..c1c8f18 100644
--- a/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs
@@ -233,10 +233,10 @@ namespace Lucene.Net.Search
Assert.AreEqual(score, h[i].Score, SCORE_COMP_THRESH, "score #" + i + " is not the same");
}
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
PrintHits("testSimpleEqualScores1", h, s);
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
@@ -259,10 +259,10 @@ namespace Lucene.Net.Search
Assert.AreEqual(score, h[i].Score, SCORE_COMP_THRESH, "score #" + i + " is not the same");
}
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
PrintHits("testSimpleEqualScores2", h, s);
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
@@ -287,10 +287,10 @@ namespace Lucene.Net.Search
Assert.AreEqual(score, h[i].Score, SCORE_COMP_THRESH, "score #" + i + " is not the same");
}
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
PrintHits("testSimpleEqualScores3", h, s);
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
@@ -314,10 +314,10 @@ namespace Lucene.Net.Search
Assert.IsTrue(score0 > score1, "d2 does not have better score then others: " + score0 + " >? " + score1);
Assert.AreEqual(score1, score2, SCORE_COMP_THRESH, "d4 and d1 don't have equal scores");
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
PrintHits("testSimpleTiebreaker", h, s);
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
@@ -353,10 +353,10 @@ namespace Lucene.Net.Search
Assert.AreEqual(score, h[i].Score, SCORE_COMP_THRESH, "score #" + i + " is not the same");
}
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
PrintHits("testBooleanRequiredEqualScores1", h, s);
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
@@ -392,10 +392,10 @@ namespace Lucene.Net.Search
float score1 = h[h.Length - 1].Score;
Assert.IsTrue(score > score1, "d1 does not have worse score then others: " + score + " >? " + score1);
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
PrintHits("testBooleanOptionalNoTiebreaker", h, s);
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
@@ -442,10 +442,10 @@ namespace Lucene.Net.Search
Assert.AreEqual("d1", doc3, "wrong fourth");
Assert.IsTrue(score2 > score3, "d1 does not have worse score then d3: " + score2 + " >? " + score3);
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
PrintHits("testBooleanOptionalWithTiebreaker", h, s);
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
@@ -492,10 +492,10 @@ namespace Lucene.Net.Search
Assert.IsTrue(score1 > score2, "d3 does not have a better score then d2: " + score1 + " >? " + score2);
Assert.IsTrue(score2 > score3, "d3 does not have a better score then d1: " + score2 + " >? " + score3);
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
PrintHits("TestBooleanOptionalWithTiebreakerAndBoost", h, s);
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs b/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs
index 4f1180b..295332b 100644
--- a/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs
+++ b/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs
@@ -161,7 +161,7 @@ namespace Lucene.Net.Util.Automaton
string s = UnicodeUtil.NewString(acc, 0, acc.Length);
Assert.IsTrue(BasicOperations.Run(a, s));
}
- catch (Exception t)
+ catch (Exception /*t*/)
{
Console.WriteLine("regexp: " + re);
if (acc != null)
@@ -172,7 +172,7 @@ namespace Lucene.Net.Util.Automaton
Console.WriteLine(" " + acc[k].ToString("x"));
}
}
- throw t;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
}
diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs b/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs
index a8a82b1..9bcdc98 100644
--- a/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs
+++ b/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs
@@ -270,14 +270,14 @@ namespace Lucene.Net.Util.Automaton
{
s = UnicodeUtil.NewString(codepoints, 0, codepoints.Length);
}
- catch (Exception e)
+ catch (Exception /*e*/)
{
Console.WriteLine(codepoints.Length + " codepoints:");
for (int j = 0; j < codepoints.Length; j++)
{
Console.WriteLine(" " + codepoints[j].ToString("x"));
}
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
var bytes = s.GetBytes(Encoding.UTF8);
diff --git a/src/Lucene.Net/Index/IndexFileDeleter.cs b/src/Lucene.Net/Index/IndexFileDeleter.cs
index 90d2fa1..3f1eb20 100644
--- a/src/Lucene.Net/Index/IndexFileDeleter.cs
+++ b/src/Lucene.Net/Index/IndexFileDeleter.cs
@@ -238,11 +238,11 @@ namespace Lucene.Net.Index
}
sis = null;
}
- catch (IOException e)
+ catch (IOException /*e*/)
{
if (SegmentInfos.GenerationFromSegmentsFileName(fileName) <= currentGen && directory.FileLength(fileName) > 0)
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
else
{
diff --git a/src/Lucene.Net/Index/IndexWriter.cs b/src/Lucene.Net/Index/IndexWriter.cs
index 53496bd..4984d97 100644
--- a/src/Lucene.Net/Index/IndexWriter.cs
+++ b/src/Lucene.Net/Index/IndexWriter.cs
@@ -594,7 +594,8 @@ namespace Lucene.Net.Index
// elements we have iterated over so far
// before throwing an exception.
readerMap.RemoveAll(toDelete);
- IOUtils.ReThrow(t);
+ //IOUtils.ReThrow(t);
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
else if (priorE == null)
{
@@ -629,7 +630,8 @@ namespace Lucene.Net.Index
// elements we have iterated over so far
// before throwing an exception.
readerMap.RemoveAll(toDelete);
- IOUtils.ReThrow(t);
+ //IOUtils.ReThrow(t);
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
else if (priorE == null)
{
@@ -3418,7 +3420,7 @@ namespace Lucene.Net.Index
{
currentCodec.SegmentInfoFormat.SegmentInfoWriter.Write(trackingDir, newInfo, fis, context);
}
- catch (System.NotSupportedException uoe)
+ catch (System.NotSupportedException /*uoe*/)
{
#pragma warning disable 612, 618
if (currentCodec is Lucene3xCodec)
@@ -3429,7 +3431,7 @@ namespace Lucene.Net.Index
}
else
{
- throw uoe;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
diff --git a/src/Lucene.Net/Index/SegmentInfos.cs b/src/Lucene.Net/Index/SegmentInfos.cs
index 2ad3398..455cb09 100644
--- a/src/Lucene.Net/Index/SegmentInfos.cs
+++ b/src/Lucene.Net/Index/SegmentInfos.cs
@@ -958,7 +958,7 @@ namespace Lucene.Net.Index
// rethrow any format exception
if (err2 is CorruptIndexException)
{
- throw;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
finally
diff --git a/src/Lucene.Net/Search/IndexSearcher.cs b/src/Lucene.Net/Search/IndexSearcher.cs
index 0da6522..8aab32c 100644
--- a/src/Lucene.Net/Search/IndexSearcher.cs
+++ b/src/Lucene.Net/Search/IndexSearcher.cs
@@ -911,9 +911,10 @@ namespace Lucene.Net.Search
return true;
}
#if !NETSTANDARD1_6
- catch (ThreadInterruptedException e)
+ catch (ThreadInterruptedException /*e*/)
{
- throw new ThreadInterruptedException(e.ToString(), e);
+ //throw new ThreadInterruptedException(e.ToString(), e);
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
#endif
catch (Exception e)
diff --git a/src/Lucene.Net/Store/FileSwitchDirectory.cs b/src/Lucene.Net/Store/FileSwitchDirectory.cs
index cceff73..29d1c9c 100644
--- a/src/Lucene.Net/Store/FileSwitchDirectory.cs
+++ b/src/Lucene.Net/Store/FileSwitchDirectory.cs
@@ -113,7 +113,7 @@ namespace Lucene.Net.Store
files.Add(f);
}
}
- catch (DirectoryNotFoundException e)
+ catch (DirectoryNotFoundException /*e*/)
{
// we got NoSuchDirectoryException from both dirs
// rethrow the first.
@@ -125,7 +125,7 @@ namespace Lucene.Net.Store
// and the primary is empty.
if (files.Count == 0)
{
- throw e;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
// we got NoSuchDirectoryException from the primary,
diff --git a/src/Lucene.Net/Store/NRTCachingDirectory.cs b/src/Lucene.Net/Store/NRTCachingDirectory.cs
index 4c1fba3..1626c83 100644
--- a/src/Lucene.Net/Store/NRTCachingDirectory.cs
+++ b/src/Lucene.Net/Store/NRTCachingDirectory.cs
@@ -150,13 +150,13 @@ namespace Lucene.Net.Store
files.Add(f);
}
}
- catch (DirectoryNotFoundException ex)
+ catch (DirectoryNotFoundException /*ex*/)
{
// however, if there are no cached files, then the directory truly
// does not "exist"
if (files.Count == 0)
{
- throw ex;
+ throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
}
}
return files.ToArray();