lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [06/21] lucenenet git commit: Replaced Lucene.Net.Core.Store.AlreadyClosedException with System.ObjectDisposedException, since it is basically reinventing the wheel.
Date Sun, 12 Mar 2017 16:38:05 GMT
Replaced Lucene.Net.Core.Store.AlreadyClosedException with System.ObjectDisposedException, since it is basically reinventing the wheel.


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

Branch: refs/heads/api-work
Commit: 4f437fec4ad3b5e95c90061318ab01deef284b88
Parents: 5ecd85c
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sat Mar 11 23:42:18 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sat Mar 11 23:42:18 2017 +0700

----------------------------------------------------------------------
 .../SimpleText/SimpleTextStoredFieldsReader.cs  |  4 +-
 .../SimpleText/SimpleTextTermVectorsReader.cs   |  4 +-
 src/Lucene.Net.Core/Analysis/Analyzer.cs        | 15 ++--
 .../CompressingStoredFieldsReader.cs            |  5 +-
 .../Compressing/CompressingTermVectorsReader.cs |  9 +--
 .../Lucene3x/Lucene3xStoredFieldsReader.cs      |  6 +-
 .../Lucene40/Lucene40StoredFieldsReader.cs      |  6 +-
 src/Lucene.Net.Core/Index/DirectoryReader.cs    |  2 +-
 src/Lucene.Net.Core/Index/DocumentsWriter.cs    |  4 +-
 src/Lucene.Net.Core/Index/IndexFileDeleter.cs   |  4 +-
 src/Lucene.Net.Core/Index/IndexReader.cs        | 10 +--
 src/Lucene.Net.Core/Index/IndexWriter.cs        | 16 ++---
 src/Lucene.Net.Core/Index/SegmentCoreReaders.cs |  4 +-
 .../Index/StandardDirectoryReader.cs            |  3 +-
 src/Lucene.Net.Core/Search/ReferenceManager.cs  | 19 +++--
 .../Search/SearcherLifetimeManager.cs           |  4 +-
 .../Store/AlreadyClosedException.cs             | 74 +++++++++++---------
 src/Lucene.Net.Core/Store/BaseDirectory.cs      |  3 +-
 .../Store/ByteBufferIndexInput.cs               | 17 ++---
 src/Lucene.Net.Core/Store/CompoundFileWriter.cs |  3 +-
 src/Lucene.Net.Core/Store/Directory.cs          |  2 +-
 src/Lucene.Net.Core/Store/IndexInput.cs         |  4 +-
 .../Store/RateLimitedDirectoryWrapper.cs        |  8 +--
 .../Util/FieldCacheSanityChecker.cs             |  5 +-
 .../Directory/DirectoryTaxonomyWriter.cs        |  8 +--
 src/Lucene.Net.Facet/Taxonomy/TaxonomyReader.cs |  7 +-
 src/Lucene.Net.Suggest/Spell/SpellChecker.cs    | 21 +++---
 .../Directory/TestDirectoryTaxonomyReader.cs    |  5 +-
 .../Directory/TestDirectoryTaxonomyWriter.cs    |  5 +-
 .../Taxonomy/TestTaxonomyCombined.cs            |  2 +-
 .../Spell/TestSpellChecker.cs                   | 12 ++--
 src/Lucene.Net.Tests/Index/TestAddIndexes.cs    |  5 +-
 .../Index/TestIndexReaderClose.cs               |  3 +-
 src/Lucene.Net.Tests/Index/TestIndexWriter.cs   |  5 +-
 .../Index/TestIndexWriterMerging.cs             |  3 +-
 .../Index/TestIndexWriterReader.cs              |  5 +-
 .../Index/TestIndexWriterWithThreads.cs         |  7 +-
 .../Index/TestParallelAtomicReader.cs           |  3 +-
 .../Index/TestParallelCompositeReader.cs        |  5 +-
 src/Lucene.Net.Tests/Index/TestReaderClosed.cs  | 10 +--
 .../Search/TestSearcherManager.cs               |  9 ++-
 src/Lucene.Net.Tests/Store/TestDirectory.cs     |  2 +-
 src/Lucene.Net.Tests/Store/TestMultiMMap.cs     | 36 +++++-----
 43 files changed, 190 insertions(+), 194 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Codecs/SimpleText/SimpleTextStoredFieldsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextStoredFieldsReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextStoredFieldsReader.cs
index 53030fc..33ffe3f 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextStoredFieldsReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextStoredFieldsReader.cs
@@ -1,6 +1,7 @@
 ´╗┐using System;
 using System.Diagnostics;
 using System.Globalization;
+using System.Reflection;
 using System.Text;
 
 namespace Lucene.Net.Codecs.SimpleText
@@ -22,7 +23,6 @@ namespace Lucene.Net.Codecs.SimpleText
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Store.AlreadyClosedException;
     using ArrayUtil = Util.ArrayUtil;
     using BufferedChecksumIndexInput = Store.BufferedChecksumIndexInput;
     using BytesRef = Util.BytesRef;
@@ -224,7 +224,7 @@ namespace Lucene.Net.Codecs.SimpleText
         {
             if (_input == null)
             {
-                throw new AlreadyClosedException("this FieldsReader is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this FieldsReader is closed");
             }
             return new SimpleTextStoredFieldsReader(_offsets, (IndexInput) _input.Clone(), _fieldInfos);
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs
index 027aab2..4621cc9 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.Globalization;
 using System.Linq;
+using System.Reflection;
 
 namespace Lucene.Net.Codecs.SimpleText
 {
@@ -24,7 +25,6 @@ namespace Lucene.Net.Codecs.SimpleText
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Store.AlreadyClosedException;
     using ArrayUtil = Util.ArrayUtil;
     using BufferedChecksumIndexInput = Store.BufferedChecksumIndexInput;
     using BytesRef = Util.BytesRef;
@@ -232,7 +232,7 @@ namespace Lucene.Net.Codecs.SimpleText
         {
             if (_input == null)
             {
-                throw new AlreadyClosedException("this TermVectorsReader is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this TermVectorsReader is closed");
             }
             return new SimpleTextTermVectorsReader(_offsets, (IndexInput)_input.Clone());
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Analysis/Analyzer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Analysis/Analyzer.cs b/src/Lucene.Net.Core/Analysis/Analyzer.cs
index 97c6ef9..88f9796 100644
--- a/src/Lucene.Net.Core/Analysis/Analyzer.cs
+++ b/src/Lucene.Net.Core/Analysis/Analyzer.cs
@@ -2,6 +2,7 @@ using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
 using System.IO;
+using System.Reflection;
 
 namespace Lucene.Net.Analysis
 {
@@ -22,8 +23,6 @@ namespace Lucene.Net.Analysis
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
-
     /// <summary>
     /// An <see cref="Analyzer"/> builds <see cref="Analysis.TokenStream"/>s, which analyze text.  It thus represents a
     /// policy for extracting index terms from text.
@@ -177,7 +176,7 @@ namespace Lucene.Net.Analysis
         /// <param name="fieldName"> the name of the field the created <see cref="Analysis.TokenStream"/> is used for </param>
         /// <param name="reader"> the reader the streams source reads from </param>
         /// <returns> <see cref="Analysis.TokenStream"/> for iterating the analyzed content of <see cref="TextReader"/> </returns>
-        /// <exception cref="AlreadyClosedException"> if the Analyzer is disposed. </exception>
+        /// <exception cref="ObjectDisposedException"> if the Analyzer is disposed. </exception>
         /// <exception cref="IOException"> if an i/o error occurs (may rarely happen for strings). </exception>
         /// <seealso cref="GetTokenStream(string, string)"/>
         public TokenStream GetTokenStream(string fieldName, TextReader reader)
@@ -214,7 +213,7 @@ namespace Lucene.Net.Analysis
         /// <param name="fieldName">the name of the field the created <see cref="Analysis.TokenStream"/> is used for</param>
         /// <param name="text">the <see cref="string"/> the streams source reads from </param>
         /// <returns><see cref="Analysis.TokenStream"/> for iterating the analyzed content of <paramref name="reader"/></returns>
-        /// <exception cref="AlreadyClosedException"> if the Analyzer is disposed. </exception>
+        /// <exception cref="ObjectDisposedException"> if the Analyzer is disposed. </exception>
         /// <exception cref="IOException"> if an i/o error occurs (may rarely happen for strings). </exception>
         /// <seealso cref="GetTokenStream(string, TextReader)"/>
         public TokenStream GetTokenStream(string fieldName, string text)
@@ -532,12 +531,12 @@ namespace Lucene.Net.Analysis
         /// Returns the currently stored value.
         /// </summary>
         /// <returns> Currently stored value or <c>null</c> if no value is stored </returns>
-        /// <exception cref="AlreadyClosedException"> if the <see cref="Analyzer"/> is closed. </exception>
+        /// <exception cref="ObjectDisposedException"> if the <see cref="Analyzer"/> is closed. </exception>
         protected internal object GetStoredValue(Analyzer analyzer)
         {
             if (analyzer.storedValue == null)
             {
-                throw new AlreadyClosedException("this Analyzer is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this Analyzer is closed");
             }
             return analyzer.storedValue.Get();
         }
@@ -546,12 +545,12 @@ namespace Lucene.Net.Analysis
         /// Sets the stored value.
         /// </summary>
         /// <param name="storedValue"> Value to store </param>
-        /// <exception cref="AlreadyClosedException"> if the <see cref="Analyzer"/> is closed. </exception>
+        /// <exception cref="ObjectDisposedException"> if the <see cref="Analyzer"/> is closed. </exception>
         protected internal void SetStoredValue(Analyzer analyzer, object storedValue)
         {
             if (analyzer.storedValue == null)
             {
-                throw new AlreadyClosedException("this Analyzer is closed");
+                throw new ObjectDisposedException("this Analyzer is closed");
             }
             analyzer.storedValue.Set(storedValue);
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsReader.cs b/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsReader.cs
index a2c54bb..a95da90 100644
--- a/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsReader.cs
@@ -2,6 +2,7 @@ using Lucene.Net.Codecs.Lucene40;
 using Lucene.Net.Support;
 using System;
 using System.Diagnostics;
+using System.Reflection;
 
 namespace Lucene.Net.Codecs.Compressing
 {
@@ -162,12 +163,12 @@ namespace Lucene.Net.Codecs.Compressing
             }
         }
 
-        /// <exception cref="AlreadyClosedException"> if this FieldsReader is closed </exception>
+        /// <exception cref="ObjectDisposedException"> if this FieldsReader is closed </exception>
         private void EnsureOpen()
         {
             if (closed)
             {
-                throw new Exception("this FieldsReader is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this FieldsReader is closed");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsReader.cs b/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsReader.cs
index 4ceb916..3e36290 100644
--- a/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsReader.cs
@@ -1,4 +1,3 @@
-using System.Linq;
 using Lucene.Net.Index;
 using Lucene.Net.Store;
 using Lucene.Net.Support;
@@ -7,6 +6,8 @@ using Lucene.Net.Util.Packed;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Linq;
+using System.Reflection;
 
 namespace Lucene.Net.Codecs.Compressing
 {
@@ -173,12 +174,12 @@ namespace Lucene.Net.Codecs.Compressing
             }
         }
 
-        /// <exception cref="AlreadyClosedException"> if this TermVectorsReader is closed </exception>
+        /// <exception cref="ObjectDisposedException"> if this TermVectorsReader is closed </exception>
         private void EnsureOpen()
         {
             if (closed)
             {
-                throw new Exception("this FieldsReader is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this FieldsReader is closed");
             }
         }
 
@@ -735,7 +736,7 @@ namespace Lucene.Net.Codecs.Compressing
 
             public override Terms GetTerms(string field)
             {
-                FieldInfo fieldInfo = outerInstance.fieldInfos.FieldInfo(field);
+                Index.FieldInfo fieldInfo = outerInstance.fieldInfos.FieldInfo(field);
                 if (fieldInfo == null)
                 {
                     return null;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xStoredFieldsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xStoredFieldsReader.cs b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xStoredFieldsReader.cs
index b30b083..9030957 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xStoredFieldsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xStoredFieldsReader.cs
@@ -1,7 +1,7 @@
 using Lucene.Net.Support;
 using System;
 using System.Diagnostics;
-using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
+using System.Reflection;
 using CompoundFileDirectory = Lucene.Net.Store.CompoundFileDirectory;
 
 namespace Lucene.Net.Codecs.Lucene3x
@@ -228,12 +228,12 @@ namespace Lucene.Net.Codecs.Lucene3x
             }
         }
 
-        /// <exception cref="AlreadyClosedException"> if this FieldsReader is closed </exception>
+        /// <exception cref="ObjectDisposedException"> if this FieldsReader is closed </exception>
         private void EnsureOpen()
         {
             if (closed)
             {
-                throw new AlreadyClosedException("this FieldsReader is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this FieldsReader is closed");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40StoredFieldsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40StoredFieldsReader.cs b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40StoredFieldsReader.cs
index db8a3eb..ab5608d 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40StoredFieldsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40StoredFieldsReader.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Support;
 using System;
 using System.Diagnostics;
+using System.Reflection;
 
 namespace Lucene.Net.Codecs.Lucene40
 {
@@ -21,7 +22,6 @@ namespace Lucene.Net.Codecs.Lucene40
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using CorruptIndexException = Lucene.Net.Index.CorruptIndexException;
     using Directory = Lucene.Net.Store.Directory;
     using FieldInfo = Lucene.Net.Index.FieldInfo;
@@ -120,12 +120,12 @@ namespace Lucene.Net.Codecs.Lucene40
             }
         }
 
-        /// <exception cref="AlreadyClosedException"> if this FieldsReader is closed </exception>
+        /// <exception cref="ObjectDisposedException"> if this FieldsReader is closed </exception>
         private void EnsureOpen()
         {
             if (closed)
             {
-                throw new AlreadyClosedException("this FieldsReader is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this FieldsReader is closed");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Index/DirectoryReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/DirectoryReader.cs b/src/Lucene.Net.Core/Index/DirectoryReader.cs
index 4635e4e..8101485 100644
--- a/src/Lucene.Net.Core/Index/DirectoryReader.cs
+++ b/src/Lucene.Net.Core/Index/DirectoryReader.cs
@@ -231,7 +231,7 @@ namespace Lucene.Net.Index
         /// <p><b>NOTE</b>: Once the writer is closed, any
         /// outstanding readers may continue to be used.  However,
         /// if you attempt to reopen any of those readers, you'll
-        /// hit an <seealso cref="Lucene.Net.Store.AlreadyClosedException"/>.</p>
+        /// hit an <seealso cref="System.ObjectDisposedException"/>.</p>
         /// </summary>
         /// <returns> DirectoryReader that covers entire index plus all
         /// changes made so far by this IndexWriter instance, or

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Index/DocumentsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/DocumentsWriter.cs b/src/Lucene.Net.Core/Index/DocumentsWriter.cs
index abbb2ad..d8175a5 100644
--- a/src/Lucene.Net.Core/Index/DocumentsWriter.cs
+++ b/src/Lucene.Net.Core/Index/DocumentsWriter.cs
@@ -4,6 +4,7 @@ using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Threading;
+using System.Reflection;
 
 namespace Lucene.Net.Index
 {
@@ -24,7 +25,6 @@ namespace Lucene.Net.Index
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Analyzer = Lucene.Net.Analysis.Analyzer;
     using BinaryDocValuesUpdate = Lucene.Net.Index.DocValuesUpdate.BinaryDocValuesUpdate;
     using BytesRef = Lucene.Net.Util.BytesRef;
@@ -236,7 +236,7 @@ namespace Lucene.Net.Index
         {
             if (closed)
             {
-                throw new AlreadyClosedException("this IndexWriter is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this IndexWriter is closed");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Index/IndexFileDeleter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/IndexFileDeleter.cs b/src/Lucene.Net.Core/Index/IndexFileDeleter.cs
index f50bf3d..215d6e1 100644
--- a/src/Lucene.Net.Core/Index/IndexFileDeleter.cs
+++ b/src/Lucene.Net.Core/Index/IndexFileDeleter.cs
@@ -4,6 +4,7 @@ using System.Diagnostics;
 using System.IO;
 using System.Text.RegularExpressions;
 using System.Threading;
+using System.Reflection;
 
 namespace Lucene.Net.Index
 {
@@ -24,7 +25,6 @@ namespace Lucene.Net.Index
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using CollectionUtil = Lucene.Net.Util.CollectionUtil;
     using Directory = Lucene.Net.Store.Directory;
     using InfoStream = Lucene.Net.Util.InfoStream;
@@ -297,7 +297,7 @@ namespace Lucene.Net.Index
         {
             if (writer == null)
             {
-                throw new AlreadyClosedException("this IndexWriter is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this IndexWriter is closed");
             }
             else
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/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 8c839da..de0fe5b 100644
--- a/src/Lucene.Net.Core/Index/IndexReader.cs
+++ b/src/Lucene.Net.Core/Index/IndexReader.cs
@@ -2,6 +2,7 @@ using Lucene.Net.Documents;
 using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
+using System.Reflection;
 using System.Runtime.CompilerServices;
 
 namespace Lucene.Net.Index
@@ -23,7 +24,6 @@ namespace Lucene.Net.Index
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Directory = Lucene.Net.Store.Directory;
     using Document = Documents.Document;
     using DocumentStoredFieldVisitor = DocumentStoredFieldVisitor;
@@ -272,7 +272,7 @@ namespace Lucene.Net.Index
             // still close the reader if it was made invalid by a child:
             if (refCount.Get() <= 0)
             {
-                throw new AlreadyClosedException("this IndexReader is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this IndexReader is closed");
             }
 
             int rc = refCount.DecrementAndGet();
@@ -307,20 +307,20 @@ namespace Lucene.Net.Index
         }
 
         /// <summary>
-        /// Throws AlreadyClosedException if this IndexReader or any
+        /// Throws ObjectDisposedException if this IndexReader or any
         /// of its child readers is closed, otherwise returns.
         /// </summary>
         protected internal void EnsureOpen()
         {
             if (refCount.Get() <= 0)
             {
-                throw new AlreadyClosedException("this IndexReader is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this IndexReader is closed");
             }
             // the happens before rule on reading the refCount, which must be after the fake write,
             // ensures that we see the value:
             if (closedByChild)
             {
-                throw new AlreadyClosedException("this IndexReader cannot be used anymore as one of its child readers was closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this IndexReader cannot be used anymore as one of its child readers was closed");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Index/IndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/IndexWriter.cs b/src/Lucene.Net.Core/Index/IndexWriter.cs
index c0fbb3d..e6418df 100644
--- a/src/Lucene.Net.Core/Index/IndexWriter.cs
+++ b/src/Lucene.Net.Core/Index/IndexWriter.cs
@@ -6,6 +6,7 @@ using System.Diagnostics;
 using System.Globalization;
 using System.IO;
 using System.Linq;
+using System.Reflection;
 using System.Text;
 using System.Threading;
 
@@ -28,7 +29,6 @@ namespace Lucene.Net.Index
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Analyzer = Lucene.Net.Analysis.Analyzer;
     using IBits = Lucene.Net.Util.IBits;
     using BytesRef = Lucene.Net.Util.BytesRef;
@@ -334,7 +334,7 @@ namespace Lucene.Net.Index
         /// <p><b>NOTE</b>: Once the writer is closed, any
         /// outstanding readers may continue to be used.  However,
         /// if you attempt to reopen any of those readers, you'll
-        /// hit an <seealso cref="AlreadyClosedException"/>.</p>
+        /// hit an <seealso cref="ObjectDisposedException"/>.</p>
         ///
         /// @lucene.experimental
         /// </summary>
@@ -743,31 +743,31 @@ namespace Lucene.Net.Index
         }
 
         /// <summary>
-        /// Used internally to throw an <seealso cref="AlreadyClosedException"/> if this
+        /// Used internally to throw an <seealso cref="ObjectDisposedException"/> if this
         /// IndexWriter has been closed or is in the process of closing.
         /// </summary>
         /// <param name="failIfClosing">
         ///          if true, also fail when {@code IndexWriter} is in the process of
         ///          closing ({@code closing=true}) but not yet done closing (
         ///          {@code closed=false}) </param>
-        /// <exception cref="AlreadyClosedException">
+        /// <exception cref="ObjectDisposedException">
         ///           if this IndexWriter is closed or in the process of closing </exception>
         protected internal void EnsureOpen(bool failIfClosing)
         {
             if (closed || (failIfClosing && closing))
             {
-                throw new AlreadyClosedException("this IndexWriter is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this IndexWriter is closed");
             }
         }
 
         /// <summary>
         /// Used internally to throw an {@link
-        /// AlreadyClosedException} if this IndexWriter has been
+        /// ObjectDisposedException} if this IndexWriter has been
         /// closed ({@code closed=true}) or is in the process of
         /// closing ({@code closing=true}).
         /// <p>
         /// Calls <seealso cref="#ensureOpen(boolean) ensureOpen(true)"/>. </summary>
-        /// <exception cref="AlreadyClosedException"> if this IndexWriter is closed </exception>
+        /// <exception cref="ObjectDisposedException"> if this IndexWriter is closed </exception>
         protected internal void EnsureOpen()
         {
             EnsureOpen(true);
@@ -2790,7 +2790,7 @@ namespace Lucene.Net.Index
                     // It's fine if a new one attempts to start because from our
                     // caller above the call will see that we are in the
                     // process of closing, and will throw an
-                    // AlreadyClosedException.
+                    // ObjectDisposedException.
                     WaitForMerges();
                 }
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs b/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs
index 21da711..21efb11 100644
--- a/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs
+++ b/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs
@@ -4,6 +4,7 @@ using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Reflection;
 
 namespace Lucene.Net.Index
 {
@@ -24,7 +25,6 @@ namespace Lucene.Net.Index
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Codec = Lucene.Net.Codecs.Codec;
     using CompoundFileDirectory = Lucene.Net.Store.CompoundFileDirectory;
     using Directory = Lucene.Net.Store.Directory;
@@ -218,7 +218,7 @@ namespace Lucene.Net.Index
                     return;
                 }
             }
-            throw new AlreadyClosedException("SegmentCoreReaders is already closed");
+            throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "SegmentCoreReaders is already closed");
         }
 
         internal NumericDocValues GetNormValues(FieldInfo fi)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Index/StandardDirectoryReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/StandardDirectoryReader.cs b/src/Lucene.Net.Core/Index/StandardDirectoryReader.cs
index 4745c87..47a66e3 100644
--- a/src/Lucene.Net.Core/Index/StandardDirectoryReader.cs
+++ b/src/Lucene.Net.Core/Index/StandardDirectoryReader.cs
@@ -23,7 +23,6 @@ namespace Lucene.Net.Index
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Directory = Lucene.Net.Store.Directory;
     using IOContext = Lucene.Net.Store.IOContext;
     using IOUtils = Lucene.Net.Util.IOUtils;
@@ -488,7 +487,7 @@ namespace Lucene.Net.Index
                     writer.DecRefDeleter(segmentInfos);
                 }
 #pragma warning disable 168
-                catch (AlreadyClosedException ex)
+                catch (ObjectDisposedException ex)
 #pragma warning restore 168
                 {
                     // this is OK, it just means our original writer was

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Search/ReferenceManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/ReferenceManager.cs b/src/Lucene.Net.Core/Search/ReferenceManager.cs
index c48f00c..78fadce 100644
--- a/src/Lucene.Net.Core/Search/ReferenceManager.cs
+++ b/src/Lucene.Net.Core/Search/ReferenceManager.cs
@@ -2,6 +2,7 @@ using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Reflection;
 
 namespace Lucene.Net.Search
 {
@@ -22,8 +23,6 @@ namespace Lucene.Net.Search
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
-
     /// <summary>
     /// Utility class to safely share instances of a certain type across multiple
     /// threads, while periodically refreshing them. this class ensures each
@@ -60,7 +59,7 @@ namespace Lucene.Net.Search
         {
             if (current == null)
             {
-                throw new AlreadyClosedException(REFERENCE_MANAGER_IS_CLOSED_MSG);
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, REFERENCE_MANAGER_IS_CLOSED_MSG);
             }
         }
 
@@ -84,14 +83,14 @@ namespace Lucene.Net.Search
         /// <summary>
         /// Refresh the given reference if needed. Returns {@code null} if no refresh
         /// was needed, otherwise a new refreshed reference. </summary>
-        /// <exception cref="AlreadyClosedException"> if the reference manager has been <seealso cref="#close() closed"/>. </exception>
+        /// <exception cref="ObjectDisposedException"> if the reference manager has been <seealso cref="#close() closed"/>. </exception>
         /// <exception cref="IOException"> if the refresh operation failed </exception>
         protected abstract G RefreshIfNeeded(G referenceToRefresh);
 
         /// <summary>
         /// Try to increment reference counting on the given reference. Return true if
         /// the operation was successful. </summary>
-        /// <exception cref="AlreadyClosedException"> if the reference manager has been <seealso cref="#close() closed"/>.  </exception>
+        /// <exception cref="ObjectDisposedException"> if the reference manager has been <seealso cref="#close() closed"/>.  </exception>
         protected abstract bool TryIncRef(G reference);
 
         /// <summary>
@@ -99,7 +98,7 @@ namespace Lucene.Net.Search
         /// call to <seealso cref="#release"/>; it's best to do so in a finally clause, and set
         /// the reference to {@code null} to prevent accidental usage after it has been
         /// released. </summary>
-        /// <exception cref="AlreadyClosedException"> if the reference manager has been <seealso cref="#close() closed"/>.  </exception>
+        /// <exception cref="ObjectDisposedException"> if the reference manager has been <seealso cref="#close() closed"/>.  </exception>
         public G Acquire()
         {
             G @ref;
@@ -108,7 +107,7 @@ namespace Lucene.Net.Search
             {
                 if ((@ref = current) == null)
                 {
-                    throw new AlreadyClosedException(REFERENCE_MANAGER_IS_CLOSED_MSG);
+                    throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, REFERENCE_MANAGER_IS_CLOSED_MSG);
                 }
                 if (TryIncRef(@ref))
                 {
@@ -146,7 +145,7 @@ namespace Lucene.Net.Search
         /// Applications should not <seealso cref="#acquire() acquire"/> new references from this
         /// manager once this method has been called. <seealso cref="#acquire() Acquiring"/> a
         /// resource on a closed <seealso cref="ReferenceManager"/> will throw an
-        /// <seealso cref="AlreadyClosedException"/>.
+        /// <seealso cref="ObjectDisposedException"/>.
         /// </p>
         /// </summary>
         /// <exception cref="IOException">
@@ -244,7 +243,7 @@ namespace Lucene.Net.Search
         /// thread is currently refreshing.
         /// </p> </summary>
         /// <exception cref="IOException"> if refreshing the resource causes an <seealso cref="IOException"/> </exception>
-        /// <exception cref="AlreadyClosedException"> if the reference manager has been <seealso cref="#close() closed"/>.  </exception>
+        /// <exception cref="ObjectDisposedException"> if the reference manager has been <seealso cref="#close() closed"/>.  </exception>
         public bool MaybeRefresh()
         {
             EnsureOpen();
@@ -277,7 +276,7 @@ namespace Lucene.Net.Search
         /// will return a refreshed instance. Otherwise, consider using the
         /// non-blocking <seealso cref="#maybeRefresh()"/>. </summary>
         /// <exception cref="IOException"> if refreshing the resource causes an <seealso cref="IOException"/> </exception>
-        /// <exception cref="AlreadyClosedException"> if the reference manager has been <seealso cref="#close() closed"/>.  </exception>
+        /// <exception cref="ObjectDisposedException"> if the reference manager has been <seealso cref="#close() closed"/>.  </exception>
         public void MaybeRefreshBlocking()
         {
             EnsureOpen();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Search/SearcherLifetimeManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/SearcherLifetimeManager.cs b/src/Lucene.Net.Core/Search/SearcherLifetimeManager.cs
index d6e2154..c6e6f07 100644
--- a/src/Lucene.Net.Core/Search/SearcherLifetimeManager.cs
+++ b/src/Lucene.Net.Core/Search/SearcherLifetimeManager.cs
@@ -2,6 +2,7 @@ using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection;
 
 namespace Lucene.Net.Search
 {
@@ -22,7 +23,6 @@ namespace Lucene.Net.Search
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using DirectoryReader = Lucene.Net.Index.DirectoryReader;
     using IOUtils = Lucene.Net.Util.IOUtils;
 
@@ -139,7 +139,7 @@ namespace Lucene.Net.Search
         {
             if (_closed)
             {
-                throw new AlreadyClosedException("this SearcherLifetimeManager instance is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this SearcherLifetimeManager instance is closed");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Store/AlreadyClosedException.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/AlreadyClosedException.cs b/src/Lucene.Net.Core/Store/AlreadyClosedException.cs
index e8a2837..5488320 100644
--- a/src/Lucene.Net.Core/Store/AlreadyClosedException.cs
+++ b/src/Lucene.Net.Core/Store/AlreadyClosedException.cs
@@ -1,37 +1,41 @@
-using System;
+// LUCENENET specific - commented this because we already have an ObjectDisposedException in .NET.
+// This is just reinventing the wheel. ObjectDisposedException, like AlreadyClosedException, subclasses 
+// InvalidOperationException, so it makes a good replacement.
 
-namespace Lucene.Net.Store
-{
-    /*
-     * Licensed to the Apache Software Foundation (ASF) under one or more
-     * contributor license agreements.  See the NOTICE file distributed with
-     * this work for additional information regarding copyright ownership.
-     * The ASF licenses this file to You under the Apache License, Version 2.0
-     * (the "License"); you may not use this file except in compliance with
-     * the License.  You may obtain a copy of the License at
-     *
-     *     http://www.apache.org/licenses/LICENSE-2.0
-     *
-     * Unless required by applicable law or agreed to in writing, software
-     * distributed under the License is distributed on an "AS IS" BASIS,
-     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     * See the License for the specific language governing permissions and
-     * limitations under the License.
-     */
+//using System;
 
-    /// <summary>
-    /// this exception is thrown when there is an attempt to
-    /// access something that has already been closed.
-    /// </summary>
-    // LUCENENET: All exeption classes should be marked serializable
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public class AlreadyClosedException : InvalidOperationException // LUCENENET TODO: Replace with ObjectDisposedException and comment out (ObjectDisposedException inherits InvalidOperationException, so it should work great)
-    {
-        public AlreadyClosedException(string message)
-            : base(message)
-        {
-        }
-    }
-}
\ No newline at end of file
+//namespace Lucene.Net.Store
+//{
+//    /*
+//     * Licensed to the Apache Software Foundation (ASF) under one or more
+//     * contributor license agreements.  See the NOTICE file distributed with
+//     * this work for additional information regarding copyright ownership.
+//     * The ASF licenses this file to You under the Apache License, Version 2.0
+//     * (the "License"); you may not use this file except in compliance with
+//     * the License.  You may obtain a copy of the License at
+//     *
+//     *     http://www.apache.org/licenses/LICENSE-2.0
+//     *
+//     * Unless required by applicable law or agreed to in writing, software
+//     * distributed under the License is distributed on an "AS IS" BASIS,
+//     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//     * See the License for the specific language governing permissions and
+//     * limitations under the License.
+//     */
+
+//    /// <summary>
+//    /// this exception is thrown when there is an attempt to
+//    /// access something that has already been closed.
+//    /// </summary>
+//    // LUCENENET: All exeption classes should be marked serializable
+//#if FEATURE_SERIALIZABLE
+//    [Serializable]
+//#endif
+//    public class AlreadyClosedException : InvalidOperationException
+//    {
+//        public AlreadyClosedException(string message)
+//            : base(message)
+//        {
+//        }
+//    }
+//}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Store/BaseDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/BaseDirectory.cs b/src/Lucene.Net.Core/Store/BaseDirectory.cs
index cfea3c6..2dd97f6 100644
--- a/src/Lucene.Net.Core/Store/BaseDirectory.cs
+++ b/src/Lucene.Net.Core/Store/BaseDirectory.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Diagnostics;
+using System.Reflection;
 
 namespace Lucene.Net.Store
 {
@@ -82,7 +83,7 @@ namespace Lucene.Net.Store
         {
             if (!IsOpen)
             {
-                throw new AlreadyClosedException("this Directory is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this Directory is closed");
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs b/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs
index 28b29d2..2b1354d 100644
--- a/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs
+++ b/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs
@@ -2,6 +2,7 @@ using Lucene.Net.Support;
 using Lucene.Net.Util;
 using System;
 using System.Diagnostics;
+using System.Reflection;
 
 namespace Lucene.Net.Store
 {
@@ -112,7 +113,7 @@ namespace Lucene.Net.Store
             }
             catch (System.NullReferenceException)
             {
-                throw new AlreadyClosedException("Already closed: " + this);
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "Already closed: " + this);
             }
         }
 
@@ -143,7 +144,7 @@ namespace Lucene.Net.Store
             }
             catch (System.NullReferenceException)
             {
-                throw new AlreadyClosedException("Already closed: " + this);
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "Already closed: " + this);
             }
         }
 
@@ -162,7 +163,7 @@ namespace Lucene.Net.Store
             }
             catch (System.NullReferenceException)
             {
-                throw new AlreadyClosedException("Already closed: " + this);
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "Already closed: " + this);
             }
         }
 
@@ -181,7 +182,7 @@ namespace Lucene.Net.Store
             }
             catch (System.NullReferenceException)
             {
-                throw new AlreadyClosedException("Already closed: " + this);
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "Already closed: " + this);
             }
         }
 
@@ -200,7 +201,7 @@ namespace Lucene.Net.Store
             }
             catch (System.NullReferenceException)
             {
-                throw new AlreadyClosedException("Already closed: " + this);
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "Already closed: " + this);
             }
         }
 
@@ -214,7 +215,7 @@ namespace Lucene.Net.Store
                 }
                 catch (System.NullReferenceException)
                 {
-                    throw new AlreadyClosedException("Already closed: " + this);
+                    throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "Already closed: " + this);
                 }
             }
         }
@@ -248,7 +249,7 @@ namespace Lucene.Net.Store
             }
             catch (System.NullReferenceException)
             {
-                throw new AlreadyClosedException("Already closed: " + this);
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "Already closed: " + this);
             }
         }
 
@@ -299,7 +300,7 @@ namespace Lucene.Net.Store
         {
             if (buffers == null)
             {
-                throw new AlreadyClosedException("Already closed: " + this);
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "Already closed: " + this);
             }
             if (offset < 0 || length < 0 || offset + length > this.length)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Store/CompoundFileWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/CompoundFileWriter.cs b/src/Lucene.Net.Core/Store/CompoundFileWriter.cs
index 6287c12..7783832 100644
--- a/src/Lucene.Net.Core/Store/CompoundFileWriter.cs
+++ b/src/Lucene.Net.Core/Store/CompoundFileWriter.cs
@@ -3,6 +3,7 @@ using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Reflection;
 
 namespace Lucene.Net.Store
 {
@@ -201,7 +202,7 @@ namespace Lucene.Net.Store
         {
             if (closed)
             {
-                throw new AlreadyClosedException("CFS Directory is already closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "CFS Directory is already closed");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/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 d9f3725..dec136a 100644
--- a/src/Lucene.Net.Core/Store/Directory.cs
+++ b/src/Lucene.Net.Core/Store/Directory.cs
@@ -274,7 +274,7 @@ namespace Lucene.Net.Store
             }
         }
 
-        /// <exception cref="AlreadyClosedException"> if this Directory is closed </exception>
+        /// <exception cref="ObjectDisposedException"> if this Directory is closed </exception>
         protected internal virtual void EnsureOpen()
         {
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Store/IndexInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/IndexInput.cs b/src/Lucene.Net.Core/Store/IndexInput.cs
index 6f3985d..1406653 100644
--- a/src/Lucene.Net.Core/Store/IndexInput.cs
+++ b/src/Lucene.Net.Core/Store/IndexInput.cs
@@ -31,7 +31,7 @@ namespace Lucene.Net.Store
     /// resource, but positioned independently. Lucene never closes cloned
     /// {@code IndexInput}s, it will only do this on the original one.
     /// The original instance must take care that cloned instances throw
-    /// <seealso cref="AlreadyClosedException"/> when the original one is closed.
+    /// <seealso cref="ObjectDisposedException"/> when the original one is closed.
     /// </summary>
     /// <seealso cref= Directory </seealso>
     public abstract class IndexInput : DataInput, IDisposable
@@ -81,7 +81,7 @@ namespace Lucene.Net.Store
         /// <p><b>Warning:</b> Lucene never closes cloned
         /// {@code IndexInput}s, it will only do this on the original one.
         /// The original instance must take care that cloned instances throw
-        /// <seealso cref="AlreadyClosedException"/> when the original one is closed.
+        /// <seealso cref="ObjectDisposedException"/> when the original one is closed.
         /// </summary>
         public override object Clone()
         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs b/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
index 6d651c2..6793f95 100644
--- a/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
+++ b/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
@@ -87,7 +87,7 @@ namespace Lucene.Net.Store
         /// </summary>
         /// <exception cref="IllegalArgumentException">
         ///           if context is <code>null</code> </exception>
-        /// <exception cref="AlreadyClosedException"> if the <seealso cref="Directory"/> is already closed
+        /// <exception cref="System.ObjectDisposedException"> if the <seealso cref="Directory"/> is already closed
         /// @lucene.experimental </exception>
         public void SetMaxWriteMBPerSec(double? mbPerSec, IOContext.UsageContext context)
         {
@@ -132,7 +132,7 @@ namespace Lucene.Net.Store
         /// </summary>
         /// <exception cref="ArgumentException">
         ///           if context is <code>null</code> </exception>
-        /// <exception cref="AlreadyClosedException"> if the <seealso cref="Directory"/> is already closed
+        /// <exception cref="System.ObjectDisposedException"> if the <seealso cref="Directory"/> is already closed
         /// @lucene.experimental </exception>
         public void SetRateLimiter(RateLimiter mergeWriteRateLimiter, IOContext.UsageContext context)
         {
@@ -143,9 +143,9 @@ namespace Lucene.Net.Store
         /// <summary>
         /// See <seealso cref="#setMaxWriteMBPerSec"/>.
         /// </summary>
-        /// <exception cref="ArgumentException">
+        /// <exception cref="System.ArgumentException">
         ///           if context is <code>null</code> </exception>
-        /// <exception cref="AlreadyClosedException"> if the <seealso cref="Directory"/> is already closed
+        /// <exception cref="System.ObjectDisposedException"> if the <seealso cref="Directory"/> is already closed
         /// @lucene.experimental </exception>
         public double GetMaxWriteMBPerSec(IOContext.UsageContext context)
         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs b/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
index 2641ee4..587e803 100644
--- a/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
+++ b/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
@@ -24,7 +24,6 @@ namespace Lucene.Net.Util
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using IndexReader = Lucene.Net.Index.IndexReader;
 
     /// <summary>
@@ -292,7 +291,7 @@ namespace Lucene.Net.Util
             {
                 var obj = all[i];
                 // TODO: We don't check closed readers here (as getTopReaderContext
-                // throws AlreadyClosedException), what should we do? Reflection?
+                // throws ObjectDisposedException), what should we do? Reflection?
                 var reader = obj as IndexReader;
                 if (reader != null)
                 {
@@ -307,7 +306,7 @@ namespace Lucene.Net.Util
                             }
                         }
                     }
-                    catch (AlreadyClosedException)
+                    catch (System.ObjectDisposedException)
                     {
                         // ignore this reader
                     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
index 64d19da..b3fa581 100644
--- a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
@@ -8,6 +8,7 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
 using System.IO;
+using System.Reflection;
 
 namespace Lucene.Net.Facet.Taxonomy.Directory
 {
@@ -28,7 +29,6 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using AtomicReader = Lucene.Net.Index.AtomicReader;
     using AtomicReaderContext = Lucene.Net.Index.AtomicReaderContext;
     using LockObtainFailedException = Lucene.Net.Store.LockObtainFailedException; // javadocs
@@ -534,13 +534,13 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
 
         /// <summary>
         /// Verifies that this instance wasn't closed, or throws
-        /// <see cref="AlreadyClosedException"/> if it is.
+        /// <see cref="ObjectDisposedException"/> if it is.
         /// </summary>
         protected internal void EnsureOpen()
         {
             if (isClosed)
             {
-                throw new AlreadyClosedException("The taxonomy writer has already been closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "The taxonomy writer has already been closed");
             }
         }
 
@@ -1102,7 +1102,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
         /// <summary>
         /// Rollback changes to the taxonomy writer and closes the instance. Following
         /// this method the instance becomes unusable (calling any of its API methods
-        /// will yield an <see cref="AlreadyClosedException"/>).
+        /// will yield an <see cref="ObjectDisposedException"/>).
         /// </summary>
         public virtual void Rollback()
         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Facet/Taxonomy/TaxonomyReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/Taxonomy/TaxonomyReader.cs b/src/Lucene.Net.Facet/Taxonomy/TaxonomyReader.cs
index dc3cf84..cbe3742 100644
--- a/src/Lucene.Net.Facet/Taxonomy/TaxonomyReader.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/TaxonomyReader.cs
@@ -2,6 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Reflection;
 using System.Threading;
 
 namespace Lucene.Net.Facet.Taxonomy
@@ -23,8 +24,6 @@ namespace Lucene.Net.Facet.Taxonomy
      * limitations under the License.
      */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
-
     /// <summary>
     /// TaxonomyReader is the read-only interface with which the faceted-search
     /// library uses the taxonomy during search time.
@@ -160,13 +159,13 @@ namespace Lucene.Net.Facet.Taxonomy
         protected abstract TaxonomyReader DoOpenIfChanged();
 
         /// <summary>
-        /// Throws <see cref="AlreadyClosedException"/> if this <see cref="Index.IndexReader"/> is disposed
+        /// Throws <see cref="ObjectDisposedException"/> if this <see cref="Index.IndexReader"/> is disposed
         /// </summary>
         protected void EnsureOpen()
         {
             if (RefCount <= 0)
             {
-                throw new AlreadyClosedException("this TaxonomyReader is closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "this TaxonomyReader is closed");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Suggest/Spell/SpellChecker.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Spell/SpellChecker.cs b/src/Lucene.Net.Suggest/Spell/SpellChecker.cs
index d3a0d52..84396c8 100644
--- a/src/Lucene.Net.Suggest/Spell/SpellChecker.cs
+++ b/src/Lucene.Net.Suggest/Spell/SpellChecker.cs
@@ -4,6 +4,7 @@ using Lucene.Net.Store;
 using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
+using System.Reflection;
 using Directory = Lucene.Net.Store.Directory;
 
 namespace Lucene.Net.Search.Spell
@@ -138,7 +139,7 @@ namespace Lucene.Net.Search.Spell
         /// the existing index if <code>spellIndex</code> is the same value
         /// as given in the constructor. </summary>
         /// <param name="spellIndexDir"> the spell directory to use </param>
-        /// <exception cref="AlreadyClosedException"> if the Spellchecker is already closed </exception>
+        /// <exception cref="ObjectDisposedException"> if the Spellchecker is already closed </exception>
         /// <exception cref="System.IO.IOException"> if spellchecker can not open the directory </exception>
         // TODO: we should make this final as it is called in the constructor
         public virtual void SetSpellIndex(Directory spellIndexDir)
@@ -227,7 +228,7 @@ namespace Lucene.Net.Search.Spell
         /// <param name="word"> the word you want a spell check done on </param>
         /// <param name="numSug"> the number of suggested words </param>
         /// <exception cref="System.IO.IOException"> if the underlying index throws an <see cref="System.IO.IOException"/> </exception>
-        /// <exception cref="AlreadyClosedException"> if the Spellchecker is already disposed </exception>
+        /// <exception cref="ObjectDisposedException"> if the Spellchecker is already disposed </exception>
         /// <returns>string[] the sorted list of the suggest words with these 2 criteria:
         /// first criteria: the edit distance, second criteria (only if restricted mode): the popularity
         /// of the suggest words in the field of the user index</returns>
@@ -254,7 +255,7 @@ namespace Lucene.Net.Search.Spell
         /// <param name="numSug"> the number of suggested words </param>
         /// <param name="accuracy"> The minimum score a suggestion must have in order to qualify for inclusion in the results </param>
         /// <exception cref="System.IO.IOException"> if the underlying index throws an <see cref="System.IO.IOException"/> </exception>
-        /// <exception cref="AlreadyClosedException"> if the Spellchecker is already disposed </exception>
+        /// <exception cref="ObjectDisposedException"> if the Spellchecker is already disposed </exception>
         /// <returns>string[] the sorted list of the suggest words with these 2 criteria:
         /// first criteria: the edit distance, second criteria (only if restricted mode): the popularity
         /// of the suggest words in the field of the user index</returns>
@@ -296,7 +297,7 @@ namespace Lucene.Net.Search.Spell
         /// (NOTE: if indexReader==null and/or field==null, then this is overridden with SuggestMode.SUGGEST_ALWAYS) </param>
         /// <param name="accuracy"> The minimum score a suggestion must have in order to qualify for inclusion in the results </param>
         /// <exception cref="System.IO.IOException"> if the underlying index throws an <see cref="System.IO.IOException"/> </exception>
-        /// <exception cref="AlreadyClosedException"> if the <see cref="SpellChecker"/> is already disposed </exception>
+        /// <exception cref="ObjectDisposedException"> if the <see cref="SpellChecker"/> is already disposed </exception>
         /// <returns> string[] the sorted list of the suggest words with these 2 criteria:
         /// first criteria: the edit distance, second criteria (only if restricted mode): the popularity
         /// of the suggest words in the field of the user index
@@ -456,7 +457,7 @@ namespace Lucene.Net.Search.Spell
         /// <summary>
         /// Removes all terms from the spell check index. </summary>
         /// <exception cref="System.IO.IOException"> If there is a low-level I/O error. </exception>
-        /// <exception cref="AlreadyClosedException"> if the Spellchecker is already closed </exception>
+        /// <exception cref="ObjectDisposedException"> if the Spellchecker is already closed </exception>
         public virtual void ClearIndex()
         {
             lock (modifyCurrentIndexLock)
@@ -475,7 +476,7 @@ namespace Lucene.Net.Search.Spell
         /// Check whether the word exists in the index. </summary>
         /// <param name="word"> word to check </param>
         /// <exception cref="System.IO.IOException"> If there is a low-level I/O error. </exception>
-        /// <exception cref="AlreadyClosedException"> if the <see cref="SpellChecker"/> is already disposed </exception>
+        /// <exception cref="ObjectDisposedException"> if the <see cref="SpellChecker"/> is already disposed </exception>
         /// <returns> true if the word exists in the index </returns>
         public virtual bool Exist(string word)
         {
@@ -498,7 +499,7 @@ namespace Lucene.Net.Search.Spell
         /// <param name="dict"> Dictionary to index </param>
         /// <param name="config"> <see cref="IndexWriterConfig"/> to use </param>
         /// <param name="fullMerge"> whether or not the spellcheck index should be fully merged </param>
-        /// <exception cref="AlreadyClosedException"> if the <see cref="SpellChecker"/> is already disposed </exception>
+        /// <exception cref="ObjectDisposedException"> if the <see cref="SpellChecker"/> is already disposed </exception>
         /// <exception cref="System.IO.IOException"> If there is a low-level I/O error. </exception>
         public void IndexDictionary(IDictionary dict, IndexWriterConfig config, bool fullMerge)
         {
@@ -668,14 +669,14 @@ namespace Lucene.Net.Search.Spell
         {
             if (disposed)
             {
-                throw new AlreadyClosedException("Spellchecker has been closed");
+                throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "Spellchecker has been closed");
             }
         }
 
         /// <summary>
         /// Dispose the underlying IndexSearcher used by this SpellChecker </summary>
         /// <exception cref="System.IO.IOException"> if the close operation causes an <see cref="System.IO.IOException"/> </exception>
-        /// <exception cref="AlreadyClosedException"> if the <see cref="SpellChecker"/> is already disposed </exception>
+        /// <exception cref="ObjectDisposedException"> if the <see cref="SpellChecker"/> is already disposed </exception>
         public void Dispose()
         {
             if (!disposed)
@@ -705,7 +706,7 @@ namespace Lucene.Net.Search.Spell
                 if (disposed)
                 {
                     indexSearcher.IndexReader.Dispose();
-                    throw new AlreadyClosedException("Spellchecker has been closed");
+                    throw new ObjectDisposedException(this.GetType().GetTypeInfo().FullName, "Spellchecker has been closed");
                 }
                 if (searcher != null)
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyReader.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyReader.cs
index d0c267f..3fcabb8 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyReader.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyReader.cs
@@ -15,7 +15,6 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
     using OpenMode = Lucene.Net.Index.OpenMode;
     using LogByteSizeMergePolicy = Lucene.Net.Index.LogByteSizeMergePolicy;
     using LogMergePolicy = Lucene.Net.Index.LogMergePolicy;
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Directory = Lucene.Net.Store.Directory;
     using RAMDirectory = Lucene.Net.Store.RAMDirectory;
     using IOUtils = Lucene.Net.Util.IOUtils;
@@ -119,9 +118,9 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
             try
             {
                 var tmpSize = ltr.Count;
-                Fail("An AlreadyClosedException should have been thrown here");
+                Fail("An ObjectDisposedException should have been thrown here");
             }
-            catch (AlreadyClosedException)
+            catch (ObjectDisposedException)
             {
                 // good!
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
index dd48ea9..a06af2a 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
@@ -23,7 +23,6 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
     using IndexWriterConfig = Lucene.Net.Index.IndexWriterConfig;
     using SegmentInfos = Lucene.Net.Index.SegmentInfos;
     using IndexSearcher = Lucene.Net.Search.IndexSearcher;
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Directory = Lucene.Net.Store.Directory;
     using IOUtils = Lucene.Net.Util.IOUtils;
     using TestUtil = Lucene.Net.Util.TestUtil;
@@ -153,7 +152,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
                 dtw.AddCategory(new FacetLabel("a"));
                 Fail("should not have succeeded to add a category following rollback.");
             }
-            catch (AlreadyClosedException)
+            catch (ObjectDisposedException)
             {
                 // expected
             }
@@ -186,7 +185,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
                 dtw.AddCategory(new FacetLabel("a"));
                 Fail("should not have succeeded to add a category following close.");
             }
-            catch (AlreadyClosedException)
+            catch (ObjectDisposedException)
             {
                 // expected
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
index c722d7e..f3a7725 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
@@ -240,7 +240,7 @@ namespace Lucene.Net.Facet.Taxonomy
             // Do a commit(). Here was a bug - if tw had a reader open, it should
             // be reopened after the commit. However, in our case the reader should
             // not be open (as explained above) but because it was not set to null,
-            // we forgot that, tried to reopen it, and got an AlreadyClosedException.
+            // we forgot that, tried to reopen it, and got an ObjectDisposedException.
             tw.Commit();
             Assert.AreEqual(ExpectedCategories.Length + 1, tw.Count);
             tw.Dispose();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs b/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
index 14884ca..a659c05 100644
--- a/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
+++ b/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
@@ -411,7 +411,7 @@ namespace Lucene.Net.Search.Spell
                 //    spellChecker.Dispose();
                 //    fail("spellchecker was already closed");
                 //}
-                //catch (AlreadyClosedException e)
+                //catch (ObjectDisposedException e)
                 //{
                 //    // expected
                 //}
@@ -420,7 +420,7 @@ namespace Lucene.Net.Search.Spell
                     CheckCommonSuggestions(r);
                     fail("spellchecker was already closed");
                 }
-                catch (AlreadyClosedException /*e*/)
+                catch (ObjectDisposedException /*e*/)
                 {
                     // expected
                 }
@@ -430,7 +430,7 @@ namespace Lucene.Net.Search.Spell
                     spellChecker.ClearIndex();
                     fail("spellchecker was already closed");
                 }
-                catch (AlreadyClosedException /*e*/)
+                catch (ObjectDisposedException /*e*/)
                 {
                     // expected
                 }
@@ -440,7 +440,7 @@ namespace Lucene.Net.Search.Spell
                     spellChecker.IndexDictionary(new LuceneDictionary(r, field), NewIndexWriterConfig(TEST_VERSION_CURRENT, null), false);
                     fail("spellchecker was already closed");
                 }
-                catch (AlreadyClosedException /*e*/)
+                catch (ObjectDisposedException /*e*/)
                 {
                     // expected
                 }
@@ -450,7 +450,7 @@ namespace Lucene.Net.Search.Spell
                     spellChecker.SetSpellIndex(spellindex);
                     fail("spellchecker was already closed");
                 }
-                catch (AlreadyClosedException /*e*/)
+                catch (ObjectDisposedException /*e*/)
                 {
                     // expected
                 }
@@ -600,7 +600,7 @@ namespace Lucene.Net.Search.Spell
 
                             Thread.Sleep(10);// don't starve refresh()'s CPU, which sleeps every 50 bytes for 1 ms
                         }
-                        catch (AlreadyClosedException /*e*/)
+                        catch (ObjectDisposedException /*e*/)
                         {
                             return;
                         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestAddIndexes.cs b/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
index e3e18e5..8436220 100644
--- a/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
+++ b/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
@@ -27,7 +27,6 @@ namespace Lucene.Net.Index
     * limitations under the License.
     */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using BaseDirectoryWrapper = Lucene.Net.Store.BaseDirectoryWrapper;
     using Codec = Lucene.Net.Codecs.Codec;
     using Directory = Lucene.Net.Store.Directory;
@@ -860,7 +859,7 @@ namespace Lucene.Net.Index
 
             internal override void Handle(Exception t)
             {
-                if (!(t is AlreadyClosedException) && !(t is System.NullReferenceException))
+                if (!(t is ObjectDisposedException) && !(t is System.NullReferenceException))
                 {
                     Console.Error.WriteLine(t.StackTrace);
                     lock (Failures)
@@ -952,7 +951,7 @@ namespace Lucene.Net.Index
             {
                 bool report = true;
 
-                if (t is AlreadyClosedException || t is MergePolicy.MergeAbortedException || t is System.NullReferenceException)
+                if (t is ObjectDisposedException || t is MergePolicy.MergeAbortedException || t is System.NullReferenceException)
                 {
                     report = !DidClose;
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests/Index/TestIndexReaderClose.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexReaderClose.cs b/src/Lucene.Net.Tests/Index/TestIndexReaderClose.cs
index 9c96ced..fcb392f 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexReaderClose.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexReaderClose.cs
@@ -6,7 +6,6 @@ namespace Lucene.Net.Index
     using Lucene.Net.Support;
     using NUnit.Framework;
     using System;
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Directory = Lucene.Net.Store.Directory;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
 
@@ -91,7 +90,7 @@ namespace Lucene.Net.Index
                     Assert.Fail("we are closed");
                 }
 #pragma warning disable 168
-                catch (AlreadyClosedException ex)
+                catch (ObjectDisposedException ex)
 #pragma warning restore 168
                 {
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
index 434c311..e321b8f 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
@@ -32,7 +32,6 @@ namespace Lucene.Net.Index
     using NUnit.Framework;
     using System.Diagnostics;
     using System.IO;
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Automaton = Lucene.Net.Util.Automaton.Automaton;
     using BaseDirectoryWrapper = Lucene.Net.Store.BaseDirectoryWrapper;
     using BasicAutomata = Lucene.Net.Util.Automaton.BasicAutomata;
@@ -248,10 +247,10 @@ namespace Lucene.Net.Index
             try
             {
                 AddDoc(writer);
-                Assert.Fail("did not hit AlreadyClosedException");
+                Assert.Fail("did not hit ObjectDisposedException");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException e)
+            catch (ObjectDisposedException e)
 #pragma warning restore 168
             {
                 // expected

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs
index 37fc3cd..18249bf 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs
@@ -26,7 +26,6 @@ namespace Lucene.Net.Index
         /// limitations under the License.
         */
 
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Directory = Lucene.Net.Store.Directory;
     using Document = Documents.Document;
     using Field = Field;
@@ -459,7 +458,7 @@ namespace Lucene.Net.Index
                             FinalWriter.AddDocument(Doc);
                         }
 #pragma warning disable 168
-                        catch (AlreadyClosedException e)
+                        catch (ObjectDisposedException e)
 #pragma warning restore 168
                         {
                             done = true;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
index 2c17ce4..f4f1d87 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
@@ -12,7 +12,6 @@ namespace Lucene.Net.Index
     using NUnit.Framework;
     using System.Collections.Concurrent;
     using Util;
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using BytesRef = Lucene.Net.Util.BytesRef;
     using Codec = Lucene.Net.Codecs.Codec;
     using Directory = Lucene.Net.Store.Directory;
@@ -846,10 +845,10 @@ namespace Lucene.Net.Index
             try
             {
                 DirectoryReader.OpenIfChanged(r);
-                Assert.Fail("failed to hit AlreadyClosedException");
+                Assert.Fail("failed to hit ObjectDisposedException");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException ace)
+            catch (ObjectDisposedException ace)
 #pragma warning restore 168
             {
                 // expected

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
index ef67d93..a1c70d5 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
@@ -11,7 +11,6 @@ namespace Lucene.Net.Index
 {
     //using Slow = Lucene.Net.Util.LuceneTestCase.Slow;
     
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using BaseDirectoryWrapper = Lucene.Net.Store.BaseDirectoryWrapper;
     using BytesRef = Lucene.Net.Util.BytesRef;
     using Directory = Lucene.Net.Store.Directory;
@@ -60,7 +59,7 @@ namespace Lucene.Net.Index
 
             internal bool DiskFull;
             internal Exception Error;
-            internal AlreadyClosedException Ace;
+            internal ObjectDisposedException Ace;
             internal IndexWriter Writer;
             internal bool NoErrors;
             internal volatile int AddCount;
@@ -767,7 +766,7 @@ namespace Lucene.Net.Index
                                     }
                                     WriterRef.Value.Commit();
                                 }
-                                catch (AlreadyClosedException)
+                                catch (ObjectDisposedException)
                                 {
                                     // ok
                                 }
@@ -790,7 +789,7 @@ namespace Lucene.Net.Index
                                 {
                                     WriterRef.Value.AddDocument(Docs.NextDoc());
                                 }
-                                catch (AlreadyClosedException)
+                                catch (ObjectDisposedException)
                                 {
                                     // ok
                                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests/Index/TestParallelAtomicReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestParallelAtomicReader.cs b/src/Lucene.Net.Tests/Index/TestParallelAtomicReader.cs
index 4ea14e2..2bc990d 100644
--- a/src/Lucene.Net.Tests/Index/TestParallelAtomicReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestParallelAtomicReader.cs
@@ -6,7 +6,6 @@ namespace Lucene.Net.Index
     using Lucene.Net.Randomized.Generators;
     using Lucene.Net.Search;
     using NUnit.Framework;
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Directory = Lucene.Net.Store.Directory;
     using Document = Documents.Document;
     using Field = Field;
@@ -147,7 +146,7 @@ namespace Lucene.Net.Index
                 Assert.Fail("ParallelAtomicReader should be already closed because inner reader was closed!");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException e)
+            catch (ObjectDisposedException e)
 #pragma warning restore 168
             {
                 // pass

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests/Index/TestParallelCompositeReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestParallelCompositeReader.cs b/src/Lucene.Net.Tests/Index/TestParallelCompositeReader.cs
index 9b381e1..7e7e046 100644
--- a/src/Lucene.Net.Tests/Index/TestParallelCompositeReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestParallelCompositeReader.cs
@@ -6,7 +6,6 @@ namespace Lucene.Net.Index
     using Lucene.Net.Randomized.Generators;
     using Lucene.Net.Search;
     using NUnit.Framework;
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Directory = Lucene.Net.Store.Directory;
     using Document = Documents.Document;
     using Field = Field;
@@ -250,7 +249,7 @@ namespace Lucene.Net.Index
                 Assert.Fail("Subreader should be already closed because inner reader was closed!");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException e)
+            catch (ObjectDisposedException e)
 #pragma warning restore 168
             {
                 // pass
@@ -262,7 +261,7 @@ namespace Lucene.Net.Index
                 Assert.Fail("ParallelCompositeReader should be already closed because inner reader was closed!");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException e)
+            catch (ObjectDisposedException e)
 #pragma warning restore 168
             {
                 // pass

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests/Index/TestReaderClosed.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestReaderClosed.cs b/src/Lucene.Net.Tests/Index/TestReaderClosed.cs
index 99df942..64e1833 100644
--- a/src/Lucene.Net.Tests/Index/TestReaderClosed.cs
+++ b/src/Lucene.Net.Tests/Index/TestReaderClosed.cs
@@ -3,7 +3,6 @@ using Lucene.Net.Documents;
 namespace Lucene.Net.Index
 {
     using NUnit.Framework;
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Directory = Lucene.Net.Store.Directory;
     using Document = Documents.Document;
     using Field = Field;
@@ -74,7 +73,7 @@ namespace Lucene.Net.Index
                 searcher.Search(query, 5);
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException ace)
+            catch (System.ObjectDisposedException ace)
 #pragma warning restore 168
             {
                 // expected
@@ -97,9 +96,12 @@ namespace Lucene.Net.Index
             {
                 searcher.Search(query, 5);
             }
-            catch (AlreadyClosedException ace)
+            catch (System.ObjectDisposedException ace)
             {
-                Assert.AreEqual("this IndexReader cannot be used anymore as one of its child readers was closed", ace.Message);
+                //Assert.AreEqual("this IndexReader cannot be used anymore as one of its child readers was closed", ace.Message);
+                // LUCENENET specific - ObjectDisposedExeption appends the type of object to the end of the message,
+                // so we need to check the start of the message only.
+                assertTrue(ace.Message.StartsWith("this IndexReader cannot be used anymore as one of its child readers was closed"));
             }
             finally
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestSearcherManager.cs b/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
index cd03219..6f8d71a 100644
--- a/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
+++ b/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
@@ -9,7 +9,6 @@ namespace Lucene.Net.Search
     using Lucene.Net.Randomized.Generators;
     using Lucene.Net.Support;
     using NUnit.Framework;
-    using AlreadyClosedException = Lucene.Net.Store.AlreadyClosedException;
     using Directory = Lucene.Net.Store.Directory;
     using DirectoryReader = Lucene.Net.Index.DirectoryReader;
     using Document = Documents.Document;
@@ -314,7 +313,7 @@ namespace Lucene.Net.Search
                 Assert.Fail("already closed");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException ex)
+            catch (ObjectDisposedException ex)
 #pragma warning restore 168
             {
                 // expected
@@ -403,7 +402,7 @@ namespace Lucene.Net.Search
                     SearcherManager.MaybeRefresh();
                     Success.Set(true);
                 }
-                catch (AlreadyClosedException)
+                catch (ObjectDisposedException)
                 {
                     // expected
                 }
@@ -479,7 +478,7 @@ namespace Lucene.Net.Search
                 sm.Acquire();
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException e)
+            catch (ObjectDisposedException e)
 #pragma warning restore 168
             {
                 // ok
@@ -491,7 +490,7 @@ namespace Lucene.Net.Search
                 sm.MaybeRefresh();
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException e)
+            catch (ObjectDisposedException e)
 #pragma warning restore 168
             {
                 // ok

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests/Store/TestDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Store/TestDirectory.cs b/src/Lucene.Net.Tests/Store/TestDirectory.cs
index 65f0a3f..c8cbb34 100644
--- a/src/Lucene.Net.Tests/Store/TestDirectory.cs
+++ b/src/Lucene.Net.Tests/Store/TestDirectory.cs
@@ -48,7 +48,7 @@ namespace Lucene.Net.Store
                     Assert.Fail("did not hit expected exception");
                 }
 #pragma warning disable 168
-                catch (AlreadyClosedException ace)
+                catch (ObjectDisposedException ace)
 #pragma warning restore 168
                 {
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4f437fec/src/Lucene.Net.Tests/Store/TestMultiMMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Store/TestMultiMMap.cs b/src/Lucene.Net.Tests/Store/TestMultiMMap.cs
index 99baad2..f36ee9f 100644
--- a/src/Lucene.Net.Tests/Store/TestMultiMMap.cs
+++ b/src/Lucene.Net.Tests/Store/TestMultiMMap.cs
@@ -73,10 +73,10 @@ namespace Lucene.Net.Store
             try
             {
                 one.ReadVInt32();
-                Assert.Fail("Must throw AlreadyClosedException");
+                Assert.Fail("Must throw ObjectDisposedException");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException ignore)
+            catch (ObjectDisposedException ignore)
 #pragma warning restore 168
             {
                 // pass
@@ -84,10 +84,10 @@ namespace Lucene.Net.Store
             try
             {
                 two.ReadVInt32();
-                Assert.Fail("Must throw AlreadyClosedException");
+                Assert.Fail("Must throw ObjectDisposedException");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException ignore)
+            catch (ObjectDisposedException ignore)
 #pragma warning restore 168
             {
                 // pass
@@ -95,10 +95,10 @@ namespace Lucene.Net.Store
             try
             {
                 three.ReadVInt32();
-                Assert.Fail("Must throw AlreadyClosedException");
+                Assert.Fail("Must throw ObjectDisposedException");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException ignore)
+            catch (ObjectDisposedException ignore)
 #pragma warning restore 168
             {
                 // pass
@@ -125,10 +125,10 @@ namespace Lucene.Net.Store
             try
             {
                 two.ReadVInt32();
-                Assert.Fail("Must throw AlreadyClosedException");
+                Assert.Fail("Must throw ObjectDisposedException");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException ignore)
+            catch (ObjectDisposedException ignore)
 #pragma warning restore 168
             {
                 // pass
@@ -156,10 +156,10 @@ namespace Lucene.Net.Store
             try
             {
                 one.ReadInt32();
-                Assert.Fail("Must throw AlreadyClosedException");
+                Assert.Fail("Must throw ObjectDisposedException");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException ignore)
+            catch (ObjectDisposedException ignore)
 #pragma warning restore 168
             {
                 // pass
@@ -167,10 +167,10 @@ namespace Lucene.Net.Store
             try
             {
                 two.ReadInt32();
-                Assert.Fail("Must throw AlreadyClosedException");
+                Assert.Fail("Must throw ObjectDisposedException");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException ignore)
+            catch (ObjectDisposedException ignore)
 #pragma warning restore 168
             {
                 // pass
@@ -178,10 +178,10 @@ namespace Lucene.Net.Store
             try
             {
                 three.ReadInt32();
-                Assert.Fail("Must throw AlreadyClosedException");
+                Assert.Fail("Must throw ObjectDisposedException");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException ignore)
+            catch (ObjectDisposedException ignore)
 #pragma warning restore 168
             {
                 // pass
@@ -189,10 +189,10 @@ namespace Lucene.Net.Store
             try
             {
                 four.ReadInt32();
-                Assert.Fail("Must throw AlreadyClosedException");
+                Assert.Fail("Must throw ObjectDisposedException");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException ignore)
+            catch (ObjectDisposedException ignore)
 #pragma warning restore 168
             {
                 // pass
@@ -221,10 +221,10 @@ namespace Lucene.Net.Store
             try
             {
                 one.ReadInt32();
-                Assert.Fail("Must throw AlreadyClosedException");
+                Assert.Fail("Must throw ObjectDisposedException");
             }
 #pragma warning disable 168
-            catch (AlreadyClosedException ignore)
+            catch (ObjectDisposedException ignore)
 #pragma warning restore 168
             {
                 // pass


Mime
View raw message