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 eb85c679d35323e3ed1f1a720e652ab30415cbd7
Author: Shad Storhaug <[email protected]>
AuthorDate: Sat Nov 12 16:08:42 2022 +0700

    Lucene.Net.Analysis.Util.BufferedCharFilter: Use UninterruptableMonitor for 
consistency (missed a couple)
---
 .../Analysis/Util/BufferedCharFilter.cs                    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/BufferedCharFilter.cs 
b/src/Lucene.Net.Analysis.Common/Analysis/Util/BufferedCharFilter.cs
index 8bf2ee334..71ecfb9ca 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/BufferedCharFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/BufferedCharFilter.cs
@@ -303,7 +303,8 @@ namespace Lucene.Net.Analysis.Util
         /// <exception cref="IOException">if this reader is disposed or some 
other I/O error occurs.</exception>
         public override int Read(char[] buffer, int offset, int length)
         {
-            lock(m_lock)
+            UninterruptableMonitor.Enter(m_lock);
+            try
             {
                 EnsureOpen();
                 // LUCENENT specific - refactored guard clauses to throw 
individual messages.
@@ -379,6 +380,10 @@ namespace Lucene.Net.Analysis.Util
                 int count = length - outstanding;
                 return (count > 0 || count == length) ? count : 0 /*-1*/;
             }
+            finally
+            {
+                UninterruptableMonitor.Exit(m_lock);
+            }
         }
 
         /// <summary>
@@ -392,7 +397,8 @@ namespace Lucene.Net.Analysis.Util
         /// <exception cref="IOException">if this reader is disposed or some 
other I/O error occurs.</exception>
         public override string ReadLine()
         {
-            lock(m_lock)
+            UninterruptableMonitor.Enter(m_lock);
+            try
             {
                 EnsureOpen();
                 /* has the underlying stream been exhausted? */
@@ -487,6 +493,10 @@ namespace Lucene.Net.Analysis.Util
                     }
                 }
             }
+            finally
+            {
+                UninterruptableMonitor.Exit(m_lock);
+            }
         }
 
         /// <summary>

Reply via email to