lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [16/20] lucenenet git commit: SWEEP: Fixed infinite recursion bugs caused by calling base.Dispose() instead of base.Dispose(bool)
Date Sun, 02 Apr 2017 07:06:16 GMT
SWEEP: Fixed infinite recursion bugs caused by calling base.Dispose() instead of base.Dispose(bool)


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

Branch: refs/heads/api-work
Commit: b15f45d457605a3db1bde289ac0fa6091c26d199
Parents: c2ec3e2
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sun Apr 2 11:46:41 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Apr 2 11:58:36 2017 +0700

----------------------------------------------------------------------
 .../Analysis/Miscellaneous/PatternAnalyzer.cs                 | 4 ++--
 .../Analysis/Standard/ClassicTokenizer.cs                     | 2 +-
 .../Analysis/Standard/StandardTokenizer.cs                    | 2 +-
 .../Analysis/Standard/UAX29URLEmailTokenizer.cs               | 2 +-
 .../Analysis/Wikipedia/WikipediaTokenizer.cs                  | 2 +-
 src/Lucene.Net.Core/Analysis/CharFilter.cs                    | 7 +++++--
 src/Lucene.Net.Core/Analysis/TokenFilter.cs                   | 4 ++--
 src/Lucene.Net.Core/Analysis/TokenStream.cs                   | 2 +-
 src/Lucene.Net.Core/Analysis/Tokenizer.cs                     | 4 ++--
 src/Lucene.Net.Core/Index/IndexReader.cs                      | 2 +-
 src/Lucene.Net.Core/Store/Directory.cs                        | 5 ++++-
 src/Lucene.Net.Core/Store/FSDirectory.cs                      | 2 +-
 src/Lucene.Net.Core/Store/MMapDirectory.cs                    | 2 +-
 src/Lucene.Net.Core/Store/RateLimitedIndexOutput.cs           | 2 +-
 src/Lucene.Net.TestFramework/Analysis/MockGraphTokenFilter.cs | 2 +-
 src/Lucene.Net.TestFramework/Analysis/MockTokenizer.cs        | 2 +-
 src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs    | 2 +-
 .../Store/SlowClosingMockIndexInputWrapper.cs                 | 2 +-
 .../Analysis/Core/TestBugInSomething.cs                       | 2 +-
 src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs | 2 +-
 20 files changed, 30 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PatternAnalyzer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PatternAnalyzer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PatternAnalyzer.cs
index 251d30f..69fa5fb 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PatternAnalyzer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PatternAnalyzer.cs
@@ -434,9 +434,9 @@ namespace Lucene.Net.Analysis.Miscellaneous
 
             protected override void Dispose(bool disposing)
             {
+                base.Dispose(disposing);
                 if (disposing)
                 {
-                    base.Dispose();
                     this.initialized = false;
                 }
             }
@@ -571,9 +571,9 @@ namespace Lucene.Net.Analysis.Miscellaneous
 
             protected override void Dispose(bool disposing)
             {
+                base.Dispose(disposing);
                 if (disposing)
                 {
-                    base.Dispose();
                     this.str = null;
                 }
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Analysis.Common/Analysis/Standard/ClassicTokenizer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Standard/ClassicTokenizer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Standard/ClassicTokenizer.cs
index fd775db..111e23f 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Standard/ClassicTokenizer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Standard/ClassicTokenizer.cs
@@ -198,9 +198,9 @@ namespace Lucene.Net.Analysis.Standard
 
         protected override void Dispose(bool disposing)
         {
+            base.Dispose(disposing);
             if (disposing)
             {
-                base.Dispose();
                 scanner.YyReset(m_input);
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardTokenizer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardTokenizer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardTokenizer.cs
index 0c64290..3fa7bb8 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardTokenizer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardTokenizer.cs
@@ -252,9 +252,9 @@ namespace Lucene.Net.Analysis.Standard
 
         protected override void Dispose(bool disposing)
         {
+            base.Dispose(disposing);
             if (disposing)
             {
-                base.Dispose();
                 scanner.YyReset(m_input);
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Analysis.Common/Analysis/Standard/UAX29URLEmailTokenizer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Standard/UAX29URLEmailTokenizer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Standard/UAX29URLEmailTokenizer.cs
index 0ca2477..292b7bd 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Standard/UAX29URLEmailTokenizer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Standard/UAX29URLEmailTokenizer.cs
@@ -218,9 +218,9 @@ namespace Lucene.Net.Analysis.Standard
 
         protected override void Dispose(bool disposing)
         {
+            base.Dispose(disposing);
             if (disposing)
             {
-                base.Dispose();
                 scanner.YyReset(m_input);
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Analysis.Common/Analysis/Wikipedia/WikipediaTokenizer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Wikipedia/WikipediaTokenizer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Wikipedia/WikipediaTokenizer.cs
index 9b8e35e..46679ba 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Wikipedia/WikipediaTokenizer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Wikipedia/WikipediaTokenizer.cs
@@ -316,9 +316,9 @@ namespace Lucene.Net.Analysis.Wikipedia
 
         protected override void Dispose(bool disposing)
         {
+            base.Dispose(disposing);
             if (disposing)
             {
-                base.Dispose();
                 scanner.YyReset(m_input);
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Core/Analysis/CharFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Analysis/CharFilter.cs b/src/Lucene.Net.Core/Analysis/CharFilter.cs
index 460fb79..e253a1f 100644
--- a/src/Lucene.Net.Core/Analysis/CharFilter.cs
+++ b/src/Lucene.Net.Core/Analysis/CharFilter.cs
@@ -57,11 +57,14 @@ namespace Lucene.Net.Analysis
         /// <para/>
         /// <b>NOTE:</b>
         /// The default implementation closes the input <see cref="TextReader"/>, so
-        /// be sure to call <c>base.Dispose()</c> when overriding this method.
+        /// be sure to call <c>base.Dispose(disposing)</c> when overriding this
method.
         /// </summary>
         protected override void Dispose(bool disposing)
         {
-            m_input.Dispose();
+            if (disposing)
+            {
+                m_input.Dispose();
+            }
             base.Dispose(disposing);
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Core/Analysis/TokenFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Analysis/TokenFilter.cs b/src/Lucene.Net.Core/Analysis/TokenFilter.cs
index 53044f1..bd7e0b2 100644
--- a/src/Lucene.Net.Core/Analysis/TokenFilter.cs
+++ b/src/Lucene.Net.Core/Analysis/TokenFilter.cs
@@ -65,13 +65,13 @@ namespace Lucene.Net.Analysis
         /// <summary>
         /// Releases resources associated with this stream.
         /// <para/>
-        /// If you override this method, always call <c>base.Dispose()</c>, otherwise
+        /// If you override this method, always call <c>base.Dispose(disposing)</c>,
otherwise
         /// some internal state will not be correctly reset (e.g., <see cref="Tokenizer"/>
will
         /// throw <see cref="System.InvalidOperationException"/> on reuse).
         /// <para/>
         /// <b>NOTE:</b>
         /// The default implementation chains the call to the input TokenStream, so
-        /// be sure to call <c>base.Dispose()</c> when overriding this method.
+        /// be sure to call <c>base.Dispose(disposing)</c> when overriding this
method.
         /// </summary>
         protected override void Dispose(bool disposing)
         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Core/Analysis/TokenStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Analysis/TokenStream.cs b/src/Lucene.Net.Core/Analysis/TokenStream.cs
index 4bd469c..7cec955 100644
--- a/src/Lucene.Net.Core/Analysis/TokenStream.cs
+++ b/src/Lucene.Net.Core/Analysis/TokenStream.cs
@@ -210,7 +210,7 @@ namespace Lucene.Net.Analysis
         /// <summary>
         /// Releases resources associated with this stream.
         /// <para/>
-        /// If you override this method, always call <c>base.Dispose()</c>, otherwise
+        /// If you override this method, always call <c>base.Dispose(disposing)</c>,
otherwise
         /// some internal state will not be correctly reset (e.g., <see cref="Tokenizer"/>
will
         /// throw <see cref="InvalidOperationException"/> on reuse).
         /// </summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Core/Analysis/Tokenizer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Analysis/Tokenizer.cs b/src/Lucene.Net.Core/Analysis/Tokenizer.cs
index 03aecdd..0d2bd8c 100644
--- a/src/Lucene.Net.Core/Analysis/Tokenizer.cs
+++ b/src/Lucene.Net.Core/Analysis/Tokenizer.cs
@@ -67,14 +67,14 @@ namespace Lucene.Net.Analysis
         /// <summary>
         /// Releases resources associated with this stream.
         /// <para/>
-        /// If you override this method, always call <c>base.Dispose()</c>, otherwise
+        /// If you override this method, always call <c>base.Dispose(disposing)</c>,
otherwise
         /// some internal state will not be correctly reset (e.g., <see cref="Tokenizer"/>
will
         /// throw <see cref="InvalidOperationException"/> on reuse).
         /// </summary>
         /// <remarks>
         /// <b>NOTE:</b>
         /// The default implementation closes the input <see cref="TextReader"/>, so
-        /// be sure to call <c>base.Dispose()</c> when overriding this method.
+        /// be sure to call <c>base.Dispose(disposing)</c> when overriding this
method.
         /// </remarks>
         protected override void Dispose(bool disposing)
         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Core/Index/IndexReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/IndexReader.cs b/src/Lucene.Net.Core/Index/IndexReader.cs
index 420190f..c9ade02 100644
--- a/src/Lucene.Net.Core/Index/IndexReader.cs
+++ b/src/Lucene.Net.Core/Index/IndexReader.cs
@@ -552,7 +552,7 @@ namespace Lucene.Net.Index
         /// Closes files associated with this index.
         /// This method implements the disposable pattern. 
         /// It may be overridden to dispose any managed or unmanaged resources,
-        /// but be sure to call <c>base.Dispose()</c> to close files associated
with the
+        /// but be sure to call <c>base.Dispose(disposing)</c> to close files
associated with the
         /// underlying <see cref="IndexReader"/>.
         /// </summary>
         /// <param name="disposing"><c>true</c> indicates to dispose all
managed 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Core/Store/Directory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/Directory.cs b/src/Lucene.Net.Core/Store/Directory.cs
index 6d0331f..80827d8 100644
--- a/src/Lucene.Net.Core/Store/Directory.cs
+++ b/src/Lucene.Net.Core/Store/Directory.cs
@@ -280,7 +280,10 @@ namespace Lucene.Net.Store
 
             public override void Dispose(bool disposing)
             {
-                @base.Dispose();
+                if (disposing)
+                {
+                    @base.Dispose();
+                }
             }
 
             [Obsolete("Only for reading CFS files from 3.x indexes.")]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Core/Store/FSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/FSDirectory.cs b/src/Lucene.Net.Core/Store/FSDirectory.cs
index 9c8c1ae..0330e4c 100644
--- a/src/Lucene.Net.Core/Store/FSDirectory.cs
+++ b/src/Lucene.Net.Core/Store/FSDirectory.cs
@@ -497,7 +497,7 @@ namespace Lucene.Net.Store
                         IOException priorE = null;
                         try
                         {
-                            base.Dispose();
+                            base.Dispose(disposing);
                         }
                         catch (IOException ioe)
                         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Core/Store/MMapDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/MMapDirectory.cs b/src/Lucene.Net.Core/Store/MMapDirectory.cs
index a0c920c..37296e6 100644
--- a/src/Lucene.Net.Core/Store/MMapDirectory.cs
+++ b/src/Lucene.Net.Core/Store/MMapDirectory.cs
@@ -249,8 +249,8 @@ namespace Lucene.Net.Store
                         this.memoryMappedFile.Dispose();
                         this.memoryMappedFile = null;
                     }
-                    base.Dispose();
                 }
+                base.Dispose(disposing);
             }
 
             /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Core/Store/RateLimitedIndexOutput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/RateLimitedIndexOutput.cs b/src/Lucene.Net.Core/Store/RateLimitedIndexOutput.cs
index 367a57d..c61ba6f 100644
--- a/src/Lucene.Net.Core/Store/RateLimitedIndexOutput.cs
+++ b/src/Lucene.Net.Core/Store/RateLimitedIndexOutput.cs
@@ -95,7 +95,7 @@ namespace Lucene.Net.Store
             {
                 try
                 {
-                    base.Dispose();
+                    base.Dispose(disposing);
                 }
                 finally
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.TestFramework/Analysis/MockGraphTokenFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Analysis/MockGraphTokenFilter.cs b/src/Lucene.Net.TestFramework/Analysis/MockGraphTokenFilter.cs
index 129f4b5..dc84f7a 100644
--- a/src/Lucene.Net.TestFramework/Analysis/MockGraphTokenFilter.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/MockGraphTokenFilter.cs
@@ -117,7 +117,7 @@ namespace Lucene.Net.Analysis
         {
             if (disposing)
             {
-                base.Dispose();
+                base.Dispose(disposing);
                 this.Random = null;
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.TestFramework/Analysis/MockTokenizer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Analysis/MockTokenizer.cs b/src/Lucene.Net.TestFramework/Analysis/MockTokenizer.cs
index 64add2e..5a17331 100644
--- a/src/Lucene.Net.TestFramework/Analysis/MockTokenizer.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/MockTokenizer.cs
@@ -306,9 +306,9 @@ namespace Lucene.Net.Analysis
 
         protected override void Dispose(bool disposing)
         {
+            base.Dispose(disposing);
             if (disposing)
             {
-                base.Dispose();
                 // in some exceptional cases (e.g. TestIndexWriterExceptions) a test can
prematurely close()
                 // these tests should disable this check, by default we check the normal
workflow.
                 // TODO: investigate the CachingTokenFilter "double-close"... for now we
ignore this

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
index 5858a26..90dab4f 100644
--- a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
@@ -1435,7 +1435,7 @@ namespace Lucene.Net.Store
                 {
                     try
                     {
-                        base.Dispose();
+                        base.Dispose(disposing);
                     }
                     finally
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.TestFramework/Store/SlowClosingMockIndexInputWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Store/SlowClosingMockIndexInputWrapper.cs b/src/Lucene.Net.TestFramework/Store/SlowClosingMockIndexInputWrapper.cs
index 72106a9..5af71d0 100644
--- a/src/Lucene.Net.TestFramework/Store/SlowClosingMockIndexInputWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/SlowClosingMockIndexInputWrapper.cs
@@ -48,7 +48,7 @@ namespace Lucene.Net.Store
 #endif
                 finally
                 {
-                    base.Dispose();
+                    base.Dispose(disposing);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
index af81d15..5bea6c3 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
@@ -290,9 +290,9 @@ namespace Lucene.Net.Analysis.Core
 
             protected override void Dispose(bool disposing)
             {
+                base.Dispose(disposing);
                 if (disposing)
                 {
-                    base.Dispose();
                     Console.WriteLine(m_input.GetType().Name + ".close()");
                 }
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b15f45d4/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs b/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
index 5432921..c7be3a5 100644
--- a/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
+++ b/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
@@ -2168,9 +2168,9 @@ namespace Lucene.Net.Search.Highlight
 
         protected override void Dispose(bool disposing)
         {
+            base.Dispose(disposing);
             if (disposing)
             {
-                base.Dispose();
                 this.realStream.Dispose();
             }
         }


Mime
View raw message