diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/TernaryTree.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/TernaryTree.cs index 7dd428ac5f..d16d1e9f6d 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/TernaryTree.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/TernaryTree.cs @@ -775,7 +775,7 @@ public bool MoveNext() public void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } #endregion diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs index 3762720058..f57f7e9ee4 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs @@ -596,7 +596,7 @@ private void ParseAffix(JCG.SortedDictionary> affixes, patternIndex = patterns.Count; if (patternIndex > short.MaxValue) { - throw new NotSupportedException("Too many patterns, please report this to dev@lucene.apache.org"); + throw UnsupportedOperationException.Create("Too many patterns, please report this to dev@lucene.apache.org"); } seenPatterns[regex] = patternIndex; CharacterRunAutomaton pattern = new CharacterRunAutomaton((new RegExp(regex, RegExpSyntax.NONE)).ToAutomaton()); @@ -609,7 +609,7 @@ private void ParseAffix(JCG.SortedDictionary> affixes, seenStrips[strip] = stripOrd; if (stripOrd > char.MaxValue) { - throw new NotSupportedException("Too many unique strips, please report this to dev@lucene.apache.org"); + throw UnsupportedOperationException.Create("Too many unique strips, please report this to dev@lucene.apache.org"); } } @@ -628,7 +628,7 @@ private void ParseAffix(JCG.SortedDictionary> affixes, else if (appendFlagsOrd > short.MaxValue) { // this limit is probably flexible, but its a good sanity check too - throw new NotSupportedException("Too many unique append flags, please report this to dev@lucene.apache.org"); + throw UnsupportedOperationException.Create("Too many unique append flags, please report this to dev@lucene.apache.org"); } affixWriter.WriteInt16((short)flag); diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/BufferedCharFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/BufferedCharFilter.cs index 1ebcbe33fb..4d6a86e7f9 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Util/BufferedCharFilter.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/BufferedCharFilter.cs @@ -616,7 +616,7 @@ public override void Close() { if (!isDisposing) { - throw new NotSupportedException("Close() is not supported. Call Dispose() instead."); + throw UnsupportedOperationException.Create("Close() is not supported. Call Dispose() instead."); } } #endif diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs index 9aca046845..21559e6111 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs @@ -202,9 +202,9 @@ public virtual void Clear() [Obsolete("Not applicable in this class.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public virtual bool Contains(KeyValuePair item) + public virtual bool Contains(KeyValuePair item) // LUCENENET TODO: API - rather than marking this DesignerSerializationVisibility.Hidden, it would be better to make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -1124,9 +1124,9 @@ public KeyCollection(CharArrayMap outerInstance) public bool IsReadOnly => outerInstance.IsReadOnly; - public void Add(string item) + public void Add(string item) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public void Clear() @@ -1153,9 +1153,9 @@ public IEnumerator GetEnumerator() return new KeyEnumerator(outerInstance); } - public bool Remove(string item) + public bool Remove(string item) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } IEnumerator IEnumerable.GetEnumerator() @@ -1212,9 +1212,9 @@ public ValueCollection(CharArrayMap outerInstance) public bool IsReadOnly => outerInstance.IsReadOnly; - public void Add(TValue item) + public void Add(TValue item) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public void Clear() @@ -1233,9 +1233,9 @@ public bool Contains(TValue item) return false; } - public void CopyTo(TValue[] array, int arrayIndex) + public void CopyTo(TValue[] array, int arrayIndex) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public IEnumerator GetEnumerator() @@ -1243,9 +1243,9 @@ public IEnumerator GetEnumerator() return new ValueEnumerator(outerInstance); } - public bool Remove(TValue item) + public bool Remove(TValue item) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } IEnumerator IEnumerable.GetEnumerator() @@ -1335,17 +1335,17 @@ IEnumerator IEnumerable.GetEnumerator() [Obsolete("Not applicable in this class.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public virtual bool Remove(string key) + public virtual bool Remove(string key) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } [Obsolete("Not applicable in this class.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public virtual bool Remove(KeyValuePair item) + public virtual bool Remove(KeyValuePair item) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -1440,21 +1440,21 @@ internal UnmodifiableCharArraySet(ICharArrayMap map) { } - public override bool Add(object o) + public override bool Add(object o) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } - public override bool Add(ICharSequence text) + public override bool Add(ICharSequence text) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } - public override bool Add(string text) + public override bool Add(string text) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } - public override bool Add(char[] text) + public override bool Add(char[] text) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } @@ -1524,7 +1524,7 @@ public virtual TValue SetValue(TValue value) { if (!allowModify) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } TValue old = outerInstance.values[lastPos].Value; outerInstance.values[lastPos].Value = value; @@ -1630,9 +1630,9 @@ public bool Contains(object o) [Obsolete("Not applicable in this class.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public bool Remove(KeyValuePair item) + public bool Remove(KeyValuePair item) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public int Count => outerInstance.count; @@ -1641,7 +1641,7 @@ public void Clear() { if (!allowModify) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } outerInstance.Clear(); } @@ -1841,47 +1841,47 @@ public UnmodifiableCharArrayMap(ICharArrayMap map) public override void Clear() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override TValue Put(char[] text, TValue val) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override TValue Put(ICharSequence text, TValue val) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override TValue Put(string text, TValue val) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override TValue Put(object o, TValue val) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override bool Put(char[] text) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override bool Put(ICharSequence text) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override bool Put(string text) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override bool Put(object o) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } [Obsolete("Not applicable in this class.")] @@ -1889,7 +1889,7 @@ public override bool Put(object o) [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] public override bool Remove(string key) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } internal override EntrySet_ CreateEntrySet() @@ -1900,36 +1900,36 @@ internal override EntrySet_ CreateEntrySet() #region Added for better .NET support LUCENENET public override void Add(string key, TValue value) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override void Add(KeyValuePair item) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override TValue this[char[] key, int offset, int length] { get => base[key, offset, length]; - set => throw new NotSupportedException(); + set => throw UnsupportedOperationException.Create(); } public override TValue this[char[] key] { get => base[key]; - set => throw new NotSupportedException(); + set => throw UnsupportedOperationException.Create(); } public override TValue this[ICharSequence key] { get => base[key]; - set => throw new NotSupportedException(); + set => throw UnsupportedOperationException.Create(); } public override TValue this[string key] { get => base[key]; - set => throw new NotSupportedException(); + set => throw UnsupportedOperationException.Create(); } public override TValue this[object key] { get => base[key]; - set => throw new NotSupportedException(); + set => throw UnsupportedOperationException.Create(); } [Obsolete("Not applicable in this class.")] @@ -1937,7 +1937,7 @@ public override TValue this[object key] [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] public override bool Remove(KeyValuePair item) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } #endregion } diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs index 15febc0f07..030c8cc747 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs @@ -380,10 +380,10 @@ public void CopyTo(string[] array, int arrayIndex) [Obsolete("Not applicable in this class.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public virtual bool Remove(string item) + public virtual bool Remove(string item) // LUCENENET TODO: API - make an explicit implementation that isn't public { // LUCENENET NOTE: According to the documentation header, Remove should not be supported - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } // LUCENENET - Added to ensure equality checking works in tests @@ -417,7 +417,7 @@ public virtual bool UnionWith(IEnumerable other) } if (IsReadOnly) { - throw new NotSupportedException("CharArraySet is readonly"); + throw UnsupportedOperationException.Create("CharArraySet is readonly"); } bool modified = false; foreach (var item in other) @@ -444,7 +444,7 @@ public virtual bool UnionWith(IEnumerable other) } if (IsReadOnly) { - throw new NotSupportedException("CharArraySet is readonly"); + throw UnsupportedOperationException.Create("CharArraySet is readonly"); } bool modified = false; foreach (var item in other) @@ -470,7 +470,7 @@ public virtual void UnionWith(IEnumerable other) } if (IsReadOnly) { - throw new NotSupportedException("CharArraySet is readonly"); + throw UnsupportedOperationException.Create("CharArraySet is readonly"); } foreach (var item in other) { @@ -492,7 +492,7 @@ public virtual bool UnionWith(IEnumerable other) } if (IsReadOnly) { - throw new NotSupportedException("CharArraySet is readonly"); + throw UnsupportedOperationException.Create("CharArraySet is readonly"); } bool modified = false; foreach (var item in other) @@ -526,9 +526,9 @@ public virtual bool UnionWith(IEnumerable other) [Obsolete("Not applicable in this class.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public void IntersectWith(IEnumerable other) + public void IntersectWith(IEnumerable other) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } // LUCENENET - no modifications should be made outside of original @@ -536,9 +536,9 @@ public void IntersectWith(IEnumerable other) [Obsolete("Not applicable in this class.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public void ExceptWith(IEnumerable other) + public void ExceptWith(IEnumerable other) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } // LUCENENET - no modifications should be made outside of original @@ -546,9 +546,9 @@ public void ExceptWith(IEnumerable other) [Obsolete("Not applicable in this class.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public void SymmetricExceptWith(IEnumerable other) + public void SymmetricExceptWith(IEnumerable other) // LUCENENET TODO: API - make an explicit implementation that isn't public { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -1143,7 +1143,7 @@ public static bool UnionWith(this CharArraySet set, IEnumerable other) } if (set.IsReadOnly) { - throw new NotSupportedException("CharArraySet is readonly"); + throw UnsupportedOperationException.Create("CharArraySet is readonly"); } bool modified = false; foreach (var item in other) @@ -1171,7 +1171,7 @@ public static bool UnionWith(this CharArraySet set, IEnumerable other) } if (set.IsReadOnly) { - throw new NotSupportedException("CharArraySet is readonly"); + throw UnsupportedOperationException.Create("CharArraySet is readonly"); } bool modified = false; foreach (var item in other) @@ -1199,7 +1199,7 @@ public static bool UnionWith(this CharArraySet set, IEnumerable other) // } // if (set.IsReadOnly) // { - // throw new NotSupportedException("CharArraySet is readonly"); + // throw UnsupportedOperationException.Create("CharArraySet is readonly"); // } // bool modified = false; // foreach (var item in other) @@ -1227,7 +1227,7 @@ public static bool UnionWith(this CharArraySet set, IEnumerable other) // } // if (set.IsReadOnly) // { - // throw new NotSupportedException("CharArraySet is readonly"); + // throw UnsupportedOperationException.Create("CharArraySet is readonly"); // } // bool modified = false; // foreach (var item in other) @@ -1255,7 +1255,7 @@ public static bool UnionWith(this CharArraySet set, IEnumerable other) // } // if (set.IsReadOnly) // { - // throw new NotSupportedException("CharArraySet is readonly"); + // throw UnsupportedOperationException.Create("CharArraySet is readonly"); // } // bool modified = false; // foreach (var item in other) @@ -1283,7 +1283,7 @@ public static bool UnionWith(this CharArraySet set, IEnumerable other) } if (set.IsReadOnly) { - throw new NotSupportedException("CharArraySet is readonly"); + throw UnsupportedOperationException.Create("CharArraySet is readonly"); } bool modified = false; foreach (var item in other) @@ -1311,7 +1311,7 @@ public static bool UnionWith(this CharArraySet set, IEnumerable other) } if (set.IsReadOnly) { - throw new NotSupportedException("CharArraySet is readonly"); + throw UnsupportedOperationException.Create("CharArraySet is readonly"); } bool modified = false; foreach (var item in other) @@ -1340,7 +1340,7 @@ public static bool UnionWith(this CharArraySet set, IEnumerable other) } if (set.IsReadOnly) { - throw new NotSupportedException("CharArraySet is readonly"); + throw UnsupportedOperationException.Create("CharArraySet is readonly"); } bool modified = false; foreach (var item in other) @@ -1368,7 +1368,7 @@ public static bool UnionWith(this CharArraySet set, IEnumerable other) } if (set.IsReadOnly) { - throw new NotSupportedException("CharArraySet is readonly"); + throw UnsupportedOperationException.Create("CharArraySet is readonly"); } bool modified = false; foreach (var item in other) @@ -1397,7 +1397,7 @@ public static bool UnionWith(this CharArraySet set, IEnumerable other) } if (set.IsReadOnly) { - throw new NotSupportedException("CharArraySet is readonly"); + throw UnsupportedOperationException.Create("CharArraySet is readonly"); } bool modified = false; foreach (var item in other) @@ -1426,7 +1426,7 @@ public static bool UnionWith(this CharArraySet set, IEnumerable other) } if (set.IsReadOnly) { - throw new NotSupportedException("CharArraySet is readonly"); + throw UnsupportedOperationException.Create("CharArraySet is readonly"); } bool modified = false; foreach (var item in other) @@ -1455,7 +1455,7 @@ public static bool UnionWith(this CharArraySet set, IEnumerable other) } if (set.IsReadOnly) { - throw new NotSupportedException("CharArraySet is readonly"); + throw UnsupportedOperationException.Create("CharArraySet is readonly"); } bool modified = false; foreach (var item in other) diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/LongToEnglishQueryMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/LongToEnglishQueryMaker.cs index 42f4a5ce7a..78580dbc65 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/LongToEnglishQueryMaker.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/LongToEnglishQueryMaker.cs @@ -42,7 +42,7 @@ public class Int64ToEnglishQueryMaker : IQueryMaker public virtual Query MakeQuery(int size) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public virtual Query MakeQuery() diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/SpatialDocMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/SpatialDocMaker.cs index 0e9810279a..a54aa333c7 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/SpatialDocMaker.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/SpatialDocMaker.cs @@ -96,7 +96,7 @@ public DictionaryAnonymousClass(Config config) public string this[string key] { get => config.Get("spatial." + key, null); - set => throw new NotSupportedException(); + set => throw UnsupportedOperationException.Create(); } public bool TryGetValue(string key, out string value) @@ -114,25 +114,25 @@ public bool ContainsKey(string key) #region IDictionary members - ICollection IDictionary.Keys => throw new NotSupportedException(); + ICollection IDictionary.Keys => throw UnsupportedOperationException.Create(); - ICollection IDictionary.Values => throw new NotSupportedException(); + ICollection IDictionary.Values => throw UnsupportedOperationException.Create(); - int ICollection>.Count => throw new NotSupportedException(); + int ICollection>.Count => throw UnsupportedOperationException.Create(); public bool IsReadOnly => true; - void IDictionary.Add(string key, string value) => throw new NotSupportedException(); - void ICollection>.Add(KeyValuePair item) => throw new NotSupportedException(); - void ICollection>.Clear() => throw new NotSupportedException(); - bool ICollection>.Contains(KeyValuePair item) => throw new NotSupportedException(); + void IDictionary.Add(string key, string value) => throw UnsupportedOperationException.Create(); + void ICollection>.Add(KeyValuePair item) => throw UnsupportedOperationException.Create(); + void ICollection>.Clear() => throw UnsupportedOperationException.Create(); + bool ICollection>.Contains(KeyValuePair item) => throw UnsupportedOperationException.Create(); - void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) => throw new NotSupportedException(); - IEnumerator> IEnumerable>.GetEnumerator() => throw new NotSupportedException(); - bool IDictionary.Remove(string key) => throw new NotSupportedException(); - bool ICollection>.Remove(KeyValuePair item) => throw new NotSupportedException(); + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) => throw UnsupportedOperationException.Create(); + IEnumerator> IEnumerable>.GetEnumerator() => throw UnsupportedOperationException.Create(); + bool IDictionary.Remove(string key) => throw UnsupportedOperationException.Create(); + bool ICollection>.Remove(KeyValuePair item) => throw UnsupportedOperationException.Create(); - IEnumerator IEnumerable.GetEnumerator() => throw new NotSupportedException(); + IEnumerator IEnumerable.GetEnumerator() => throw UnsupportedOperationException.Create(); #endregion IDictionary members } @@ -280,7 +280,7 @@ public static IShape MakeShapeFromString(SpatialStrategy strategy, string name, public override Document MakeDocument(int size) { //TODO consider abusing the 'size' notion to number of shapes per document - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/PerfTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/PerfTask.cs index 144899475e..a85b132570 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/PerfTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/PerfTask.cs @@ -328,7 +328,7 @@ public virtual void SetParams(string @params) { if (!SupportsParams) { - throw new NotSupportedException(GetName() + " does not support command line parameters."); + throw UnsupportedOperationException.Create(GetName() + " does not support command line parameters."); } this.m_params = @params; } diff --git a/src/Lucene.Net.Codecs/Appending/AppendingPostingsFormat.cs b/src/Lucene.Net.Codecs/Appending/AppendingPostingsFormat.cs index 3890477240..a82d9ac129 100644 --- a/src/Lucene.Net.Codecs/Appending/AppendingPostingsFormat.cs +++ b/src/Lucene.Net.Codecs/Appending/AppendingPostingsFormat.cs @@ -36,7 +36,7 @@ public AppendingPostingsFormat() public override FieldsConsumer FieldsConsumer(SegmentWriteState state) { - throw new NotSupportedException("This codec can only be used for reading"); + throw UnsupportedOperationException.Create("This codec can only be used for reading"); } public override FieldsProducer FieldsProducer(SegmentReadState state) diff --git a/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs b/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs index fdbdc08955..3684236a9e 100644 --- a/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs +++ b/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs @@ -1,4 +1,4 @@ -using Lucene.Net.Diagnostics; +using Lucene.Net.Diagnostics; using Lucene.Net.Index; using Lucene.Net.Store; using Lucene.Net.Support; @@ -867,7 +867,7 @@ public override long Ord { if (!doOrd) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } return state.Ord; } diff --git a/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs b/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs index 6457020b6d..32ee9c2d3c 100644 --- a/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs +++ b/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs @@ -179,11 +179,11 @@ public override long Next() } } - public override long Ord => throw new NotSupportedException(); + public override long Ord => throw UnsupportedOperationException.Create(); public override long Seek(long ord) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } diff --git a/src/Lucene.Net.Codecs/Bloom/BloomFilteringPostingsFormat.cs b/src/Lucene.Net.Codecs/Bloom/BloomFilteringPostingsFormat.cs index ed22cce3bb..003f72e3c2 100644 --- a/src/Lucene.Net.Codecs/Bloom/BloomFilteringPostingsFormat.cs +++ b/src/Lucene.Net.Codecs/Bloom/BloomFilteringPostingsFormat.cs @@ -114,7 +114,7 @@ public override FieldsConsumer FieldsConsumer(SegmentWriteState state) { if (_delegatePostingsFormat == null) { - throw new NotSupportedException("Error - constructed without a choice of PostingsFormat"); + throw UnsupportedOperationException.Create("Error - constructed without a choice of PostingsFormat"); } return new BloomFilteredFieldsConsumer(this, _delegatePostingsFormat.FieldsConsumer(state), state); } diff --git a/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs b/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs index ee63af2679..5f8ecf990c 100644 --- a/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs +++ b/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs @@ -373,7 +373,7 @@ public bool MoveNext() public void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } #region IDisposable Support diff --git a/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs b/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs index ea700f0e47..8153b782ed 100644 --- a/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs +++ b/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs @@ -1751,12 +1751,12 @@ public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPos public override SeekStatus SeekCeil(BytesRef term) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override void SeekExact(long ord) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } diff --git a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs index e36151467d..48007dfeef 100644 --- a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs +++ b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs @@ -441,10 +441,10 @@ public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPos // and should have related tests public override void SeekExact(long ord) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } - public override long Ord => throw new NotSupportedException(); + public override long Ord => throw UnsupportedOperationException.Create(); } // Iterates through all terms in this field @@ -654,7 +654,7 @@ internal override void DecodeStats() public override SeekStatus SeekCeil(BytesRef target) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override bool MoveNext() diff --git a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs index cf2154b81d..3a3a9fcde4 100644 --- a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs +++ b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs @@ -298,10 +298,10 @@ public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPos public override void SeekExact(long ord) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } - public override long Ord => throw new NotSupportedException(); + public override long Ord => throw UnsupportedOperationException.Create(); } diff --git a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs index dfa42f7fec..f831bc8273 100644 --- a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs +++ b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs @@ -502,9 +502,11 @@ public void Dispose() this.ords.Dispose(); } - public void Reset() + // LUCENENET: Remove() not supported in .NET + + public void Reset() // LUCENENET: Required by .NET contract, but not supported here. { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } diff --git a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs index 1398f90628..49428e6045 100644 --- a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs +++ b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs @@ -806,18 +806,18 @@ public override void SeekExact(long ord) public override long Ord => input.Current.Output.Value; - public override int DocFreq => throw new NotSupportedException(); + public override int DocFreq => throw UnsupportedOperationException.Create(); - public override long TotalTermFreq => throw new NotSupportedException(); + public override long TotalTermFreq => throw UnsupportedOperationException.Create(); public override DocsEnum Docs(IBits liveDocs, DocsEnum reuse, DocsFlags flags) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } diff --git a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs index 9d51b0ee12..7a9ff0188e 100644 --- a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs +++ b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs @@ -879,12 +879,12 @@ public override long TotalTermFreq public override void SeekExact(long ord) { // NOTE: we could add this... - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } - public override long Ord => throw + public override long Ord => // NOTE: we could add this... - new NotSupportedException(); + throw UnsupportedOperationException.Create(); } private sealed class TermsReader : Terms diff --git a/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs b/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs index 59e18bda1c..b1d552d54e 100644 --- a/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs +++ b/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs @@ -202,7 +202,7 @@ public override int SetField(FieldInfo fieldInfo) // LUCENENET specific - to avoid boxing, changed from CompareTo() to IndexOptionsComparer.Compare() if (IndexOptionsComparer.Default.Compare(indexOptions, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) { - throw new NotSupportedException("this codec cannot index offsets"); + throw UnsupportedOperationException.Create("this codec cannot index offsets"); } skipListWriter.SetIndexOptions(indexOptions); storePayloads = indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS && fieldInfo.HasPayloads; diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs index 949461120f..7439c7094d 100644 --- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs +++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs @@ -180,11 +180,11 @@ public override BytesRef Next() public override BytesRef Term => _fstEnum.Current.Input; - public override long Ord => throw new NotSupportedException(); + public override long Ord => throw UnsupportedOperationException.Create(); public override void SeekExact(long ord) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override int DocFreq => _docFreq; diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs index 2d2e610bbd..802472a88f 100644 --- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs +++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs @@ -383,7 +383,7 @@ public override SeekStatus SeekCeil(BytesRef text) public override void SeekExact(long ord) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override bool MoveNext() @@ -409,7 +409,7 @@ public override BytesRef Next() public override BytesRef Term => _current.Key; - public override long Ord => throw new NotSupportedException(); + public override long Ord => throw UnsupportedOperationException.Create(); public override int DocFreq => 1; diff --git a/src/Lucene.Net.Expressions/ExpressionRescorer.cs b/src/Lucene.Net.Expressions/ExpressionRescorer.cs index 8f0d7c91b3..5a948e2268 100644 --- a/src/Lucene.Net.Expressions/ExpressionRescorer.cs +++ b/src/Lucene.Net.Expressions/ExpressionRescorer.cs @@ -61,7 +61,7 @@ public FakeScorer() public override int Advance(int target) { - throw new NotSupportedException("FakeScorer doesn't support Advance(int)"); + throw UnsupportedOperationException.Create("FakeScorer doesn't support Advance(int)"); } public override int DocID => doc; @@ -70,7 +70,7 @@ public override int Advance(int target) public override int NextDoc() { - throw new NotSupportedException("FakeScorer doesn't support NextDoc()"); + throw UnsupportedOperationException.Create("FakeScorer doesn't support NextDoc()"); } public override float GetScore() @@ -83,11 +83,11 @@ public override long GetCost() return 1; } - public override Weight Weight => throw new NotSupportedException(); + public override Weight Weight => throw UnsupportedOperationException.Create(); public override ICollection GetChildren() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } diff --git a/src/Lucene.Net.Expressions/SimpleBindings.cs b/src/Lucene.Net.Expressions/SimpleBindings.cs index d1d1ceb22c..dacfb12826 100644 --- a/src/Lucene.Net.Expressions/SimpleBindings.cs +++ b/src/Lucene.Net.Expressions/SimpleBindings.cs @@ -115,7 +115,7 @@ public override ValueSource GetValueSource(string name) default: { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } diff --git a/src/Lucene.Net.Facet/DrillSidewaysQuery.cs b/src/Lucene.Net.Facet/DrillSidewaysQuery.cs index 123c90f67c..2f57ed5dd3 100644 --- a/src/Lucene.Net.Facet/DrillSidewaysQuery.cs +++ b/src/Lucene.Net.Facet/DrillSidewaysQuery.cs @@ -146,7 +146,7 @@ public override void Normalize(float norm, float topLevelBoost) public override Scorer GetScorer(AtomicReaderContext context, IBits acceptDocs) { // We can only run as a top scorer: - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override BulkScorer GetBulkScorer(AtomicReaderContext context, bool scoreDocsInOrder, IBits acceptDocs) diff --git a/src/Lucene.Net.Facet/DrillSidewaysScorer.cs b/src/Lucene.Net.Facet/DrillSidewaysScorer.cs index eb37386aba..9f8e167e1a 100644 --- a/src/Lucene.Net.Facet/DrillSidewaysScorer.cs +++ b/src/Lucene.Net.Facet/DrillSidewaysScorer.cs @@ -748,7 +748,7 @@ public FakeScorer(DrillSidewaysScorer outerInstance) public override int Advance(int target) { - throw new NotSupportedException("FakeScorer doesn't support advance(int)"); + throw UnsupportedOperationException.Create("FakeScorer doesn't support Advance(int)"); } public override int DocID => outerInstance.collectDocID; @@ -757,7 +757,7 @@ public override int Advance(int target) public override int NextDoc() { - throw new NotSupportedException("FakeScorer doesn't support nextDoc()"); + throw UnsupportedOperationException.Create("FakeScorer doesn't support NextDoc()"); } public override float GetScore() @@ -775,7 +775,7 @@ public override ICollection GetChildren() return new[] { new Scorer.ChildScorer(outerInstance.baseScorer, "MUST") }; } - public override Weight Weight => throw new NotSupportedException(); + public override Weight Weight => throw UnsupportedOperationException.Create(); } internal class DocsAndCost : IComparable diff --git a/src/Lucene.Net.Facet/Range/DoubleRange.cs b/src/Lucene.Net.Facet/Range/DoubleRange.cs index 4eee95ca81..eb42e8034e 100644 --- a/src/Lucene.Net.Facet/Range/DoubleRange.cs +++ b/src/Lucene.Net.Facet/Range/DoubleRange.cs @@ -227,7 +227,7 @@ public virtual bool Get(int docID) public override DocIdSetIterator GetIterator() { - throw new NotSupportedException("this filter can only be accessed via bits()"); + throw UnsupportedOperationException.Create("this filter can only be accessed via Bits"); } } } diff --git a/src/Lucene.Net.Facet/Range/LongRange.cs b/src/Lucene.Net.Facet/Range/LongRange.cs index 69672ae15f..1c71b620c3 100644 --- a/src/Lucene.Net.Facet/Range/LongRange.cs +++ b/src/Lucene.Net.Facet/Range/LongRange.cs @@ -224,7 +224,7 @@ public virtual bool Get(int docID) public override DocIdSetIterator GetIterator() { - throw new NotSupportedException("this filter can only be accessed via bits()"); + throw UnsupportedOperationException.Create("this filter can only be accessed via Bits"); } } } diff --git a/src/Lucene.Net.Facet/Range/RangeFacetCounts.cs b/src/Lucene.Net.Facet/Range/RangeFacetCounts.cs index 6dbb8d9721..af9a7cdf03 100644 --- a/src/Lucene.Net.Facet/Range/RangeFacetCounts.cs +++ b/src/Lucene.Net.Facet/Range/RangeFacetCounts.cs @@ -85,7 +85,7 @@ public override FacetResult GetTopChildren(int topN, string dim, params string[] public override float GetSpecificValue(string dim, params string[] path) { // TODO: should we impl this? - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override IList GetAllDims(int topN) diff --git a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs index ef0463c1a7..c8a0d09ac6 100644 --- a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs +++ b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs @@ -83,27 +83,27 @@ public override float GetScore() { return score; } - public override int Freq => throw new NotSupportedException(); + public override int Freq => throw UnsupportedOperationException.Create(); public override int DocID => docID; public override int NextDoc() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override int Advance(int target) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override long GetCost() { return 0; } - public override Weight Weight => throw new NotSupportedException(); + public override Weight Weight => throw UnsupportedOperationException.Create(); public override ICollection GetChildren() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } diff --git a/src/Lucene.Net.Facet/Taxonomy/WriterCache/CollisionMap.cs b/src/Lucene.Net.Facet/Taxonomy/WriterCache/CollisionMap.cs index d2e723bf5d..168f790832 100644 --- a/src/Lucene.Net.Facet/Taxonomy/WriterCache/CollisionMap.cs +++ b/src/Lucene.Net.Facet/Taxonomy/WriterCache/CollisionMap.cs @@ -261,7 +261,7 @@ public Entry Next() // LUCENENET specific - .NET doesn't support Remove() anyway, so we can nix this //public void Remove() //{ - // throw new NotSupportedException(); + // throw UnsupportedOperationException.Create(); //} public void Dispose() diff --git a/src/Lucene.Net.Highlighter/Highlight/WeightedSpanTermExtractor.cs b/src/Lucene.Net.Highlighter/Highlight/WeightedSpanTermExtractor.cs index cec91d8bee..458f794c9a 100644 --- a/src/Lucene.Net.Highlighter/Highlight/WeightedSpanTermExtractor.cs +++ b/src/Lucene.Net.Highlighter/Highlight/WeightedSpanTermExtractor.cs @@ -399,7 +399,7 @@ internal sealed class DelegatingAtomicReader : FilterAtomicReader internal DelegatingAtomicReader(AtomicReader reader) : base(reader) { } - public override FieldInfos FieldInfos => throw new NotSupportedException(); + public override FieldInfos FieldInfos => throw UnsupportedOperationException.Create(); public override Fields Fields => new DelegatingFilterFields(base.Fields); diff --git a/src/Lucene.Net.Highlighter/PostingsHighlight/MultiTermHighlighting.cs b/src/Lucene.Net.Highlighter/PostingsHighlight/MultiTermHighlighting.cs index fc83d5c027..e9c8c85164 100644 --- a/src/Lucene.Net.Highlighter/PostingsHighlight/MultiTermHighlighting.cs +++ b/src/Lucene.Net.Highlighter/PostingsHighlight/MultiTermHighlighting.cs @@ -320,7 +320,7 @@ public override BytesRef GetPayload() public override int NextDoc() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override int Advance(int target) diff --git a/src/Lucene.Net.Join/FakeScorer.cs b/src/Lucene.Net.Join/FakeScorer.cs index a089ccc54f..ea82400942 100644 --- a/src/Lucene.Net.Join/FakeScorer.cs +++ b/src/Lucene.Net.Join/FakeScorer.cs @@ -37,16 +37,16 @@ public FakeScorer() public override int Advance(int target) { - throw new NotSupportedException("FakeScorer doesn't support Advance(int)"); + throw UnsupportedOperationException.Create("FakeScorer doesn't support Advance(int)"); } public override int DocID => doc; - public override int Freq => throw new NotSupportedException("FakeScorer doesn't support Freq"); + public override int Freq => throw UnsupportedOperationException.Create("FakeScorer doesn't support Freq"); public override int NextDoc() { - throw new NotSupportedException("FakeScorer doesn't support NextDoc()"); + throw UnsupportedOperationException.Create("FakeScorer doesn't support NextDoc()"); } public override float GetScore() @@ -59,11 +59,11 @@ public override long GetCost() return 1; } - public override Weight Weight => throw new NotSupportedException(); + public override Weight Weight => throw UnsupportedOperationException.Create(); public override ICollection GetChildren() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } \ No newline at end of file diff --git a/src/Lucene.Net.Join/ToChildBlockJoinQuery.cs b/src/Lucene.Net.Join/ToChildBlockJoinQuery.cs index 55adab2f73..5557c5bc57 100644 --- a/src/Lucene.Net.Join/ToChildBlockJoinQuery.cs +++ b/src/Lucene.Net.Join/ToChildBlockJoinQuery.cs @@ -144,7 +144,7 @@ public override Scorer GetScorer(AtomicReaderContext readerContext, IBits accept public override Explanation Explain(AtomicReaderContext reader, int doc) { // TODO - throw new NotSupportedException(GetType().Name + " cannot explain match on parent document"); + throw UnsupportedOperationException.Create(GetType().Name + " cannot explain match on parent document"); } public override bool ScoresDocsOutOfOrder => false; diff --git a/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs b/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs index 6ff3c01aaa..20ea486e2e 100644 --- a/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs +++ b/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs @@ -145,7 +145,7 @@ public bool MoveNext() public void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } diff --git a/src/Lucene.Net.Misc/Index/Sorter/BlockJoinComparatorSource.cs b/src/Lucene.Net.Misc/Index/Sorter/BlockJoinComparatorSource.cs index 57b3c0001a..3d126ceef7 100644 --- a/src/Lucene.Net.Misc/Index/Sorter/BlockJoinComparatorSource.cs +++ b/src/Lucene.Net.Misc/Index/Sorter/BlockJoinComparatorSource.cs @@ -148,7 +148,7 @@ public override void SetBottom(int slot) public override void SetTopValue(object value) { // we dont have enough information (the docid is needed) - throw new NotSupportedException("this comparer cannot be used with deep paging"); + throw UnsupportedOperationException.Create("this comparer cannot be used with deep paging"); } public override int CompareBottom(int doc) @@ -159,7 +159,7 @@ public override int CompareBottom(int doc) public override int CompareTop(int doc) { // we dont have enough information (the docid is needed) - throw new NotSupportedException("this comparer cannot be used with deep paging"); + throw UnsupportedOperationException.Create("this comparer cannot be used with deep paging"); } public override void Copy(int slot, int doc) @@ -195,7 +195,7 @@ public override FieldComparer SetNextReader(AtomicReaderContext context) // LUCENENET NOTE: This was value(int) in Lucene. public override IComparable this[int slot] => throw // really our sort "value" is more complex... - new NotSupportedException("filling sort field values is not yet supported"); + UnsupportedOperationException.Create("filling sort field values is not yet supported"); public override void SetScorer(Scorer scorer) { diff --git a/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs b/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs index d4210bb724..e0ffcf29d1 100644 --- a/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs +++ b/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs @@ -332,25 +332,25 @@ public ScorerAnonymousClass() public override float GetScore() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } - public override int Freq => throw new NotSupportedException(); + public override int Freq => throw UnsupportedOperationException.Create(); - public override int DocID => throw new NotSupportedException(); + public override int DocID => throw UnsupportedOperationException.Create(); public override int NextDoc() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override int Advance(int target) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override long GetCost() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } diff --git a/src/Lucene.Net.Queries/Function/FunctionValues.cs b/src/Lucene.Net.Queries/Function/FunctionValues.cs index 71aebbf6da..2b0fb4b333 100644 --- a/src/Lucene.Net.Queries/Function/FunctionValues.cs +++ b/src/Lucene.Net.Queries/Function/FunctionValues.cs @@ -40,7 +40,7 @@ public abstract class FunctionValues { public virtual byte ByteVal(int doc) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -48,7 +48,7 @@ public virtual byte ByteVal(int doc) /// public virtual short Int16Val(int doc) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -56,7 +56,7 @@ public virtual short Int16Val(int doc) /// public virtual float SingleVal(int doc) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -64,7 +64,7 @@ public virtual float SingleVal(int doc) /// public virtual int Int32Val(int doc) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -72,18 +72,18 @@ public virtual int Int32Val(int doc) /// public virtual long Int64Val(int doc) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public virtual double DoubleVal(int doc) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } // TODO: should we make a termVal, returns BytesRef? public virtual string StrVal(int doc) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public virtual bool BoolVal(int doc) @@ -125,11 +125,11 @@ public virtual bool Exists(int doc) /// TODO: Maybe we can just use intVal for this... public virtual int OrdVal(int doc) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// the number of unique sort ordinals this instance has - public virtual int NumOrd => throw new NotSupportedException(); + public virtual int NumOrd => throw UnsupportedOperationException.Create(); public abstract string ToString(int doc); @@ -188,7 +188,7 @@ public virtual ValueFiller GetValueFiller() //For Functions that can work with multiple values from the same document. This does not apply to all functions public virtual void ByteVal(int doc, byte[] vals) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -196,7 +196,7 @@ public virtual void ByteVal(int doc, byte[] vals) /// public virtual void Int16Val(int doc, short[] vals) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -204,7 +204,7 @@ public virtual void Int16Val(int doc, short[] vals) /// public virtual void SingleVal(int doc, float[] vals) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -212,7 +212,7 @@ public virtual void SingleVal(int doc, float[] vals) /// public virtual void Int32Val(int doc, int[] vals) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -220,18 +220,18 @@ public virtual void Int32Val(int doc, int[] vals) /// public virtual void Int64Val(int doc, long[] vals) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public virtual void DoubleVal(int doc, double[] vals) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } // TODO: should we make a termVal, fills BytesRef[]? public virtual void StrVal(int doc, string[] vals) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public virtual Explanation Explain(int doc) diff --git a/src/Lucene.Net.Queries/Function/ValueSources/IDFValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/IDFValueSource.cs index e64c3c3569..046c42260c 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/IDFValueSource.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/IDFValueSource.cs @@ -50,7 +50,7 @@ public override FunctionValues GetValues(IDictionary context, AtomicReaderContex TFIDFSimilarity sim = AsTFIDF(searcher.Similarity, m_field); if (sim == null) { - throw new NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)"); + throw UnsupportedOperationException.Create("requires a TFIDFSimilarity (such as DefaultSimilarity)"); } int docfreq = searcher.IndexReader.DocFreq(new Term(m_indexedField, m_indexedBytes)); float idf = sim.Idf(docfreq, searcher.IndexReader.MaxDoc); diff --git a/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs index 6a270ab7d5..a9313b26ee 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs @@ -60,7 +60,7 @@ public override FunctionValues GetValues(IDictionary context, AtomicReaderContex TFIDFSimilarity similarity = IDFValueSource.AsTFIDF(searcher.Similarity, m_field); if (similarity == null) { - throw new NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)"); + throw UnsupportedOperationException.Create("requires a TFIDFSimilarity (such as DefaultSimilarity)"); } NumericDocValues norms = readerContext.AtomicReader.GetNormValues(m_field); diff --git a/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs index 1db46eaae3..ce412bf865 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs @@ -52,7 +52,7 @@ public override FunctionValues GetValues(IDictionary context, AtomicReaderContex var similarity = IDFValueSource.AsTFIDF(searcher.Similarity, m_indexedField); if (similarity == null) { - throw new NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)"); + throw UnsupportedOperationException.Create("requires a TFIDFSimilarity (such as DefaultSimilarity)"); } return new SingleDocValuesAnonymousClass(this, this, terms, similarity); diff --git a/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs b/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs index fa089ae208..b1b5de1006 100644 --- a/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs +++ b/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs @@ -579,7 +579,8 @@ private void AddTermFrequencies(TextReader r, IDictionary termFre { if (Analyzer == null) { - throw new NotSupportedException("To use MoreLikeThis without " + "term vectors, you must provide an Analyzer"); + throw UnsupportedOperationException.Create("To use MoreLikeThis without " + + "term vectors, you must provide an Analyzer"); } var ts = Analyzer.GetTokenStream(fieldName, r); try diff --git a/src/Lucene.Net.QueryParser/Surround/Query/RewriteQuery.cs b/src/Lucene.Net.QueryParser/Surround/Query/RewriteQuery.cs index c9857f550d..473e3cfacf 100644 --- a/src/Lucene.Net.QueryParser/Surround/Query/RewriteQuery.cs +++ b/src/Lucene.Net.QueryParser/Surround/Query/RewriteQuery.cs @@ -79,7 +79,7 @@ public override bool Equals(object obj) /// throws always: clone is not supported. public override object Clone() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } diff --git a/src/Lucene.Net.QueryParser/Surround/Query/SrndQuery.cs b/src/Lucene.Net.QueryParser/Surround/Query/SrndQuery.cs index 8440bcdda9..1f62f4b2f5 100644 --- a/src/Lucene.Net.QueryParser/Surround/Query/SrndQuery.cs +++ b/src/Lucene.Net.QueryParser/Surround/Query/SrndQuery.cs @@ -118,17 +118,17 @@ internal sealed class EmptyLcnQuery : BooleanQuery public override float Boost { get => base.Boost; - set => throw new NotSupportedException(); + set => throw UnsupportedOperationException.Create(); } public override void Add(BooleanClause clause) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override void Add(Search.Query query, Occur occur) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } diff --git a/src/Lucene.Net.Replicator/Http/HttpReplicator.cs b/src/Lucene.Net.Replicator/Http/HttpReplicator.cs index fa50fe3dc8..5c4f98cd9d 100644 --- a/src/Lucene.Net.Replicator/Http/HttpReplicator.cs +++ b/src/Lucene.Net.Replicator/Http/HttpReplicator.cs @@ -94,7 +94,7 @@ public virtual Stream ObtainFile(string sessionId, string source, string fileNam /// this replicator implementation does not support remote publishing of revisions public virtual void Publish(IRevision revision) { - throw new NotSupportedException("this replicator implementation does not support remote publishing of revisions"); + throw UnsupportedOperationException.Create("this replicator implementation does not support remote publishing of revisions"); } /// diff --git a/src/Lucene.Net.Sandbox/Queries/SortedSetSortField.cs b/src/Lucene.Net.Sandbox/Queries/SortedSetSortField.cs index 95c02c96f3..40896e498e 100644 --- a/src/Lucene.Net.Sandbox/Queries/SortedSetSortField.cs +++ b/src/Lucene.Net.Sandbox/Queries/SortedSetSortField.cs @@ -161,7 +161,7 @@ protected override SortedDocValues GetSortedDocValues(AtomicReaderContext contex if (sortedSet.ValueCount >= int.MaxValue) { - throw new NotSupportedException("fields containing more than " + (int.MaxValue - 1) + " unique terms are unsupported"); + throw UnsupportedOperationException.Create("fields containing more than " + (int.MaxValue - 1) + " unique terms are unsupported"); } SortedDocValues singleton = DocValues.UnwrapSingleton(sortedSet); @@ -180,7 +180,7 @@ protected override SortedDocValues GetSortedDocValues(AtomicReaderContext contex { if (sortedSet is RandomAccessOrds == false) { - throw new NotSupportedException("codec does not support random access ordinals, cannot use selector: " + outerInstance.selector); + throw UnsupportedOperationException.Create("codec does not support random access ordinals, cannot use selector: " + outerInstance.selector); } RandomAccessOrds randomOrds = (RandomAccessOrds)sortedSet; switch (outerInstance.selector) diff --git a/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs b/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs index 48247ef586..a172f7a5ec 100644 --- a/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs +++ b/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs @@ -102,7 +102,7 @@ public override ValueSource MakeDistanceValueSource(IPoint queryPoint, double mu public override ConstantScoreQuery MakeQuery(SpatialArgs args) { - throw new NotSupportedException("This strategy can't return a query that operates" + + throw UnsupportedOperationException.Create("This strategy can't return a query that operates" + " efficiently. Instead try a Filter or ValueSource."); } @@ -162,7 +162,7 @@ public DocIdSetAnonymousClass(PredicateValueSourceFilter outerInstance, AtomicRe public override DocIdSetIterator GetIterator() { - throw new NotSupportedException( + throw UnsupportedOperationException.Create( "Iteration is too slow; instead try FilteredQuery.QUERY_FIRST_FILTER_STRATEGY"); //Note that if you're truly bent on doing this, then see FunctionValues.getRangeScorer } diff --git a/src/Lucene.Net.Spatial/Vector/PointVectorStrategy.cs b/src/Lucene.Net.Spatial/Vector/PointVectorStrategy.cs index 7d42266c30..7a903b27c9 100644 --- a/src/Lucene.Net.Spatial/Vector/PointVectorStrategy.cs +++ b/src/Lucene.Net.Spatial/Vector/PointVectorStrategy.cs @@ -88,7 +88,7 @@ public override Field[] CreateIndexableFields(IShape shape) if (shape is IPoint point) return CreateIndexableFields(point); - throw new NotSupportedException("Can only index IPoint, not " + shape); + throw UnsupportedOperationException.Create("Can only index IPoint, not " + shape); } /// @@ -150,7 +150,7 @@ public override ConstantScoreQuery MakeQuery(SpatialArgs args) return new ConstantScoreQuery(vsf); } - throw new NotSupportedException("Only IRectangles and ICircles are currently supported, " + + throw UnsupportedOperationException.Create("Only IRectangles and ICircles are currently supported, " + "found [" + shape.GetType().Name + "]"); //TODO } @@ -160,13 +160,13 @@ public virtual Query MakeQueryDistanceScore(SpatialArgs args) // For starters, just limit the bbox var shape = args.Shape; if (!(shape is IRectangle || shape is ICircle)) - throw new NotSupportedException("Only Rectangles and Circles are currently supported, found [" + throw UnsupportedOperationException.Create("Only IRectangles and ICircles are currently supported, found [" + shape.GetType().Name + "]");//TODO IRectangle bbox = shape.BoundingBox; if (bbox.CrossesDateLine) { - throw new NotSupportedException("Crossing dateline not yet supported"); + throw UnsupportedOperationException.Create("Crossing dateline not yet supported"); } ValueSource valueSource = null; @@ -261,7 +261,7 @@ private NumericRangeQuery RangeQuery(string fieldName, double? min, doub private Query MakeDisjoint(IRectangle bbox) { if (bbox.CrossesDateLine) - throw new NotSupportedException("MakeDisjoint doesn't handle dateline cross"); + throw UnsupportedOperationException.Create("MakeDisjoint doesn't handle dateline cross"); Query qX = RangeQuery(fieldNameX, bbox.MinX, bbox.MaxX); Query qY = RangeQuery(fieldNameY, bbox.MinY, bbox.MaxY); diff --git a/src/Lucene.Net.Suggest/Spell/DirectSpellChecker.cs b/src/Lucene.Net.Suggest/Spell/DirectSpellChecker.cs index 91e43326f2..3d2a5efa96 100644 --- a/src/Lucene.Net.Suggest/Spell/DirectSpellChecker.cs +++ b/src/Lucene.Net.Suggest/Spell/DirectSpellChecker.cs @@ -121,7 +121,7 @@ public virtual int MaxEdits { if (value < 1 || value > LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE) { - throw new NotSupportedException("Invalid maxEdits"); + throw UnsupportedOperationException.Create("Invalid maxEdits"); } maxEdits = value; } diff --git a/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs b/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs index 7130e7495e..a01631dd8d 100644 --- a/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs +++ b/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs @@ -487,11 +487,11 @@ internal SuggestWordArrayWrapper(SuggestWord[] suggestWords) public int FreqSum => freqSum; - // Required by the PriorityQueue's generic constraint, but we are using + // LUCENENET: Required by the PriorityQueue's generic constraint, but we are using // IComparer here rather than IComparable public int CompareTo(SuggestWordArrayWrapper other) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } @@ -510,11 +510,11 @@ internal CombineSuggestionWrapper(CombineSuggestion combineSuggestion, int numCo public int NumCombinations => numCombinations; - // Required by the PriorityQueue's generic constraint, but we are using + // LUCENENET: Required by the PriorityQueue's generic constraint, but we are using // IComparer here rather than IComparable public int CompareTo(CombineSuggestionWrapper other) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs index 208897ff7c..2f2e754e4c 100644 --- a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs +++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs @@ -1023,7 +1023,7 @@ internal Automaton ToLookupAutomaton(string key) /// public virtual object Get(string key) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -1039,7 +1039,7 @@ private static int EncodeWeight(long value) { if (value < 0 || value > int.MaxValue) { - throw new NotSupportedException("cannot encode value: " + value); + throw UnsupportedOperationException.Create("cannot encode value: " + value); } return int.MaxValue - (int)value; } diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs index ab42e988d1..e5f5b35c83 100644 --- a/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs +++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs @@ -913,7 +913,7 @@ private static long DecodeWeight(long? output) /// public virtual object Get(string key) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } \ No newline at end of file diff --git a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs index 9d2459b81e..76c6727642 100644 --- a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs +++ b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs @@ -251,7 +251,7 @@ private static int EncodeWeight(long value) { if (value < int.MinValue || value > int.MaxValue) { - throw new NotSupportedException("cannot encode value: " + value); + throw UnsupportedOperationException.Create("cannot encode value: " + value); } return (int)value; } diff --git a/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs b/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs index 4872d85b2d..20bfd19b84 100644 --- a/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs +++ b/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs @@ -288,7 +288,7 @@ private static int EncodeWeight(long value) { if (value < 0 || value > int.MaxValue) { - throw new NotSupportedException("cannot encode value: " + value); + throw UnsupportedOperationException.Create("cannot encode value: " + value); } return int.MaxValue - (int)value; } diff --git a/src/Lucene.Net.TestFramework/Analysis/CannedBinaryTokenStream.cs b/src/Lucene.Net.TestFramework/Analysis/CannedBinaryTokenStream.cs index cf88f694ca..430478b6b3 100644 --- a/src/Lucene.Net.TestFramework/Analysis/CannedBinaryTokenStream.cs +++ b/src/Lucene.Net.TestFramework/Analysis/CannedBinaryTokenStream.cs @@ -98,7 +98,7 @@ public override void CopyTo(IAttribute target) public override object Clone() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldsWriter.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldsWriter.cs index b151b323c2..a9b243af74 100644 --- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldsWriter.cs +++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldsWriter.cs @@ -87,7 +87,7 @@ public override TermsConsumer AddField(FieldInfo field) // LUCENENET specific - to avoid boxing, changed from CompareTo() to IndexOptionsComparer.Compare() if (IndexOptionsComparer.Default.Compare(field.IndexOptions, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) { - throw new NotSupportedException("this codec cannot index offsets"); + throw UnsupportedOperationException.Create("this codec cannot index offsets"); } //System.out.println("w field=" + field.Name + " storePayload=" + field.storePayloads + " number=" + field.number); return new PreFlexTermsWriter(this, field); diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWNormsConsumer.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWNormsConsumer.cs index 050391e1ce..9b2497581f 100644 --- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWNormsConsumer.cs +++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWNormsConsumer.cs @@ -81,7 +81,7 @@ public override void AddNumericField(FieldInfo field, IEnumerable values) { if (((sbyte)n) < sbyte.MinValue || ((sbyte)n) > sbyte.MaxValue) { - throw new NotSupportedException("3.x cannot index norms that won't fit in a byte, got: " + ((sbyte)n)); + throw UnsupportedOperationException.Create("3.x cannot index norms that won't fit in a byte, got: " + ((sbyte)n)); } @out.WriteByte((byte)n); } diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWTermVectorsWriter.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWTermVectorsWriter.cs index a5953bbbe4..9c3129efeb 100644 --- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWTermVectorsWriter.cs +++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWTermVectorsWriter.cs @@ -81,7 +81,7 @@ public override void StartField(FieldInfo info, int numTerms, bool positions, bo lastFieldName = info.Name; if (payloads) { - throw new NotSupportedException("3.x codec does not support payloads on vectors!"); + throw UnsupportedOperationException.Create("3.x codec does not support payloads on vectors!"); } this.positions = positions; this.offsets = offsets; diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40DocValuesWriter.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40DocValuesWriter.cs index 683c5cab86..a4deba480d 100644 --- a/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40DocValuesWriter.cs +++ b/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40DocValuesWriter.cs @@ -606,7 +606,7 @@ private void AddVarSortedBytesField(FieldInfo field, IndexOutput data, IndexOutp public override void AddSortedSetField(FieldInfo field, IEnumerable values, IEnumerable docToOrdCount, IEnumerable ords) { - throw new NotSupportedException("Lucene 4.0 does not support SortedSet docvalues"); + throw UnsupportedOperationException.Create("Lucene 4.0 does not support SortedSet docvalues"); } protected override void Dispose(bool disposing) diff --git a/src/Lucene.Net.TestFramework/Codecs/MissingOrdRemapper.cs b/src/Lucene.Net.TestFramework/Codecs/MissingOrdRemapper.cs index cf0e6c30f6..541febf698 100644 --- a/src/Lucene.Net.TestFramework/Codecs/MissingOrdRemapper.cs +++ b/src/Lucene.Net.TestFramework/Codecs/MissingOrdRemapper.cs @@ -89,7 +89,7 @@ public bool MoveNext() object IEnumerator.Current => Current; public void Reset() - => throw new NotSupportedException(); + => throw UnsupportedOperationException.Create(); public void Dispose() => @in.Dispose(); @@ -149,7 +149,7 @@ public bool MoveNext() object IEnumerator.Current => Current; public void Reset() - => throw new NotSupportedException(); + => throw UnsupportedOperationException.Create(); public void Dispose() => @in.Dispose(); @@ -208,7 +208,7 @@ public bool MoveNext() object IEnumerator.Current => Current; public void Reset() - => throw new NotSupportedException(); + => throw UnsupportedOperationException.Create(); public void Dispose() => @in.Dispose(); diff --git a/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs index bee1234c64..990f5667b5 100644 --- a/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs +++ b/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs @@ -253,7 +253,7 @@ public override TermsConsumer AddField(FieldInfo field) // LUCENENET specific - to avoid boxing, changed from CompareTo() to IndexOptionsComparer.Compare() if (IndexOptionsComparer.Default.Compare(field.IndexOptions, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) { - throw new NotSupportedException("this codec cannot index offsets"); + throw UnsupportedOperationException.Create("this codec cannot index offsets"); } RAMField ramField = new RAMField(field.Name, field); postings.fieldToTerms[field.Name] = ramField; @@ -420,10 +420,10 @@ public override SeekStatus SeekCeil(BytesRef term) } public override void SeekExact(long ord) - => throw new NotSupportedException(); + => throw UnsupportedOperationException.Create(); public override long Ord - => throw new NotSupportedException(); + => throw UnsupportedOperationException.Create(); // TODO: reuse BytesRef public override BytesRef Term => new BytesRef(current); diff --git a/src/Lucene.Net.TestFramework/Search/RandomOrderCollector.cs b/src/Lucene.Net.TestFramework/Search/RandomOrderCollector.cs index 8b957eed91..f59bb4993d 100644 --- a/src/Lucene.Net.TestFramework/Search/RandomOrderCollector.cs +++ b/src/Lucene.Net.TestFramework/Search/RandomOrderCollector.cs @@ -114,6 +114,6 @@ public bool AcceptsDocsOutOfOrder => @in.AcceptsDocsOutOfOrder; public void SetNextReader(AtomicReaderContext context) - => throw new NotSupportedException(); + => throw UnsupportedOperationException.Create(); } } \ No newline at end of file diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs index d81d979482..99404217e8 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs @@ -73,52 +73,52 @@ public CharFilterAnonymousClass(StringReader java) : base(java) public override void Mark(int readAheadLimit) { - throw new NotSupportedException("Mark(int)"); + throw UnsupportedOperationException.Create("Mark(int)"); } - public override bool IsMarkSupported => throw new NotSupportedException("IsMarkSupported"); + public override bool IsMarkSupported => throw UnsupportedOperationException.Create("IsMarkSupported"); public override int Read() { - throw new NotSupportedException("Read()"); + throw UnsupportedOperationException.Create("Read()"); } // LUCENENET: We don't support these overloads in .NET // public override int Read(char[] cbuf) // { - //throw new NotSupportedException("Read(char[])"); + //throw UnsupportedOperationException.Create("Read(char[])"); // } //public override int read(CharBuffer target) //{ - // throw new NotSupportedException("Read(CharBuffer)"); + // throw UnsupportedOperationException.Create("Read(CharBuffer)"); //} - public override bool IsReady => throw new NotSupportedException("Ready()"); + public override bool IsReady => throw UnsupportedOperationException.Create("Ready()"); public override void Reset() { - throw new NotSupportedException("Reset()"); + throw UnsupportedOperationException.Create("Reset()"); } public override long Skip(int n) { - throw new NotSupportedException("Skip(long)"); + throw UnsupportedOperationException.Create("Skip(long)"); } protected override int Correct(int currentOff) { - throw new NotSupportedException("Correct(int)"); + throw UnsupportedOperationException.Create("Correct(int)"); } protected override void Dispose(bool disposing) { - throw new NotSupportedException("Close()"); + throw UnsupportedOperationException.Create("Close()"); } public override int Read(char[] arg0, int arg1, int arg2) { - throw new NotSupportedException("Read(char[], int, int)"); + throw UnsupportedOperationException.Create("Read(char[], int, int)"); } } diff --git a/src/Lucene.Net.Tests.Analysis.Morfologik/Morfologik/TestMorfologikFilterFactory.cs b/src/Lucene.Net.Tests.Analysis.Morfologik/Morfologik/TestMorfologikFilterFactory.cs index c63987244a..47105d2ce4 100644 --- a/src/Lucene.Net.Tests.Analysis.Morfologik/Morfologik/TestMorfologikFilterFactory.cs +++ b/src/Lucene.Net.Tests.Analysis.Morfologik/Morfologik/TestMorfologikFilterFactory.cs @@ -35,17 +35,17 @@ private class ForbidResourcesLoader : IResourceLoader { public Type FindType(string cname) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public T NewInstance(string cname) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public Stream OpenResource(string resource) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } diff --git a/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs b/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs index 2c339a80b0..d0ada3e1a9 100644 --- a/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs +++ b/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs @@ -1191,17 +1191,17 @@ public override double DoubleVal(int doc) public override bool Equals(object o) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override int GetHashCode() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override string GetDescription() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestStandardQP.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestStandardQP.cs index e315d646b4..137a2e9f3a 100644 --- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestStandardQP.cs +++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestStandardQP.cs @@ -97,14 +97,14 @@ public override void SetDefaultOperatorAND(ICommonQueryParserConfiguration cqpC) public override void SetAnalyzeRangeTerms(ICommonQueryParserConfiguration cqpC, bool value) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override void SetAutoGeneratePhraseQueries(ICommonQueryParserConfiguration cqpC, bool value) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } diff --git a/src/Lucene.Net.Tests/Index/Test2BTerms.cs b/src/Lucene.Net.Tests/Index/Test2BTerms.cs index ef84814052..3a88aa946f 100644 --- a/src/Lucene.Net.Tests/Index/Test2BTerms.cs +++ b/src/Lucene.Net.Tests/Index/Test2BTerms.cs @@ -133,7 +133,7 @@ public override void CopyTo(IAttribute target) public override object Clone() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } diff --git a/src/Lucene.Net.Tests/Index/TestCustomNorms.cs b/src/Lucene.Net.Tests/Index/TestCustomNorms.cs index bdce4e48e6..ddf42e9615 100644 --- a/src/Lucene.Net.Tests/Index/TestCustomNorms.cs +++ b/src/Lucene.Net.Tests/Index/TestCustomNorms.cs @@ -133,12 +133,12 @@ public override long ComputeNorm(FieldInvertState state) public override SimWeight ComputeWeight(float queryBoost, CollectionStatistics collectionStats, params TermStatistics[] termStats) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override SimScorer GetSimScorer(SimWeight weight, AtomicReaderContext context) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs index 3919b360d0..e8b079a2e4 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs @@ -2671,7 +2671,7 @@ public virtual IEnumerable Next() public virtual void Remove() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } }*/ } diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs index 63493bb07d..04e682b866 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs @@ -1806,7 +1806,7 @@ public override IndexInput OpenInput(string name, IOContext context) && name.StartsWith("segments_", StringComparison.Ordinal) && StackTraceHelper.DoesStackTraceContainMethod("Read")) { - throw new NotSupportedException("expected UOE"); + throw UnsupportedOperationException.Create("expected UOE"); } return base.OpenInput(name, context); diff --git a/src/Lucene.Net.Tests/Index/TestNorms.cs b/src/Lucene.Net.Tests/Index/TestNorms.cs index da38b0bf2c..634cefdf46 100644 --- a/src/Lucene.Net.Tests/Index/TestNorms.cs +++ b/src/Lucene.Net.Tests/Index/TestNorms.cs @@ -240,12 +240,12 @@ public override long ComputeNorm(FieldInvertState state) public override SimWeight ComputeWeight(float queryBoost, CollectionStatistics collectionStats, params TermStatistics[] termStats) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override SimScorer GetSimScorer(SimWeight weight, AtomicReaderContext context) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } diff --git a/src/Lucene.Net.Tests/Search/JustCompileSearch.cs b/src/Lucene.Net.Tests/Search/JustCompileSearch.cs index 1bd067e51e..c04a2d9745 100644 --- a/src/Lucene.Net.Tests/Search/JustCompileSearch.cs +++ b/src/Lucene.Net.Tests/Search/JustCompileSearch.cs @@ -43,47 +43,47 @@ internal sealed class JustCompileCollector : ICollector { public void Collect(int doc) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public void SetNextReader(AtomicReaderContext context) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public void SetScorer(Scorer scorer) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } - public bool AcceptsDocsOutOfOrder => throw new NotSupportedException(UNSUPPORTED_MSG); + public bool AcceptsDocsOutOfOrder => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } internal sealed class JustCompileDocIdSet : DocIdSet { public override DocIdSetIterator GetIterator() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } internal sealed class JustCompileDocIdSetIterator : DocIdSetIterator { - public override int DocID => throw new NotSupportedException(UNSUPPORTED_MSG); + public override int DocID => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); public override int NextDoc() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override int Advance(int target) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override long GetCost() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } @@ -94,12 +94,12 @@ internal sealed class JustCompileExtendedFieldCacheLongParser : FieldCache.IInt6 /// public long ParseInt64(BytesRef @string) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public TermsEnum TermsEnum(Terms terms) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } @@ -107,12 +107,12 @@ internal sealed class JustCompileExtendedFieldCacheDoubleParser : FieldCache.IDo { public double ParseDouble(BytesRef term) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public TermsEnum TermsEnum(Terms terms) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } @@ -120,40 +120,40 @@ internal sealed class JustCompileFieldComparer : FieldComparer { public override int Compare(int slot1, int slot2) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override int CompareBottom(int doc) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override void Copy(int slot, int doc) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override void SetBottom(int slot) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override void SetTopValue(object value) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override FieldComparer SetNextReader(AtomicReaderContext context) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } // LUCENENET NOTE: This was value(int) in Lucene. - public override IComparable this[int slot] => throw new NotSupportedException(UNSUPPORTED_MSG); + public override IComparable this[int slot] => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); public override int CompareTop(int doc) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } @@ -161,7 +161,7 @@ internal sealed class JustCompileFieldComparerSource : FieldComparerSource { public override FieldComparer NewComparer(string fieldname, int numHits, int sortPos, bool reversed) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } @@ -185,7 +185,7 @@ public JustCompileFilteredDocIdSet(DocIdSet innerSet) protected override bool Match(int docid) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } @@ -198,12 +198,12 @@ public JustCompileFilteredDocIdSetIterator(DocIdSetIterator innerIter) protected override bool Match(int doc) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override long GetCost() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } @@ -211,7 +211,7 @@ internal sealed class JustCompileQuery : Query { public override string ToString(string field) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } @@ -224,26 +224,26 @@ internal JustCompileScorer(Weight weight) public override float GetScore() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } - public override int Freq => throw new NotSupportedException(UNSUPPORTED_MSG); + public override int Freq => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); - public override int DocID => throw new NotSupportedException(UNSUPPORTED_MSG); + public override int DocID => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); public override int NextDoc() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override int Advance(int target) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override long GetCost() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } @@ -251,17 +251,17 @@ internal sealed class JustCompileSimilarity : Similarity { public override SimWeight ComputeWeight(float queryBoost, CollectionStatistics collectionStats, params TermStatistics[] termStats) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override SimScorer GetSimScorer(SimWeight stats, AtomicReaderContext context) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override long ComputeNorm(FieldInvertState state) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } @@ -274,34 +274,34 @@ internal JustCompileTopDocsCollector(PriorityQueue pq) public override void Collect(int doc) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override void SetNextReader(AtomicReaderContext context) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override void SetScorer(Scorer scorer) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } - public override bool AcceptsDocsOutOfOrder => throw new NotSupportedException(UNSUPPORTED_MSG); + public override bool AcceptsDocsOutOfOrder => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); public override TopDocs GetTopDocs() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override TopDocs GetTopDocs(int start) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override TopDocs GetTopDocs(int start, int end) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } @@ -309,24 +309,24 @@ internal sealed class JustCompileWeight : Weight { public override Explanation Explain(AtomicReaderContext context, int doc) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } - public override Query Query => throw new NotSupportedException(UNSUPPORTED_MSG); + public override Query Query => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); public override void Normalize(float norm, float topLevelBoost) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override float GetValueForNormalization() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override Scorer GetScorer(AtomicReaderContext context, IBits acceptDocs) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } } diff --git a/src/Lucene.Net.Tests/Search/Spans/JustCompileSearchSpans.cs b/src/Lucene.Net.Tests/Search/Spans/JustCompileSearchSpans.cs index 23fced5e4b..0c4b78976e 100644 --- a/src/Lucene.Net.Tests/Search/Spans/JustCompileSearchSpans.cs +++ b/src/Lucene.Net.Tests/Search/Spans/JustCompileSearchSpans.cs @@ -39,47 +39,47 @@ internal sealed class JustCompileSearchSpans internal sealed class JustCompileSpans : Spans { - public override int Doc => throw new NotSupportedException(UNSUPPORTED_MSG); + public override int Doc => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); - public override int End => throw new NotSupportedException(UNSUPPORTED_MSG); + public override int End => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); public override bool MoveNext() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override bool SkipTo(int target) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } - public override int Start => throw new NotSupportedException(UNSUPPORTED_MSG); + public override int Start => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); public override ICollection GetPayload() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } - public override bool IsPayloadAvailable => throw new NotSupportedException(UNSUPPORTED_MSG); + public override bool IsPayloadAvailable => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); public override long GetCost() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } internal sealed class JustCompileSpanQuery : SpanQuery { - public override string Field => throw new NotSupportedException(UNSUPPORTED_MSG); + public override string Field => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); public override Spans GetSpans(AtomicReaderContext context, IBits acceptDocs, IDictionary termContexts) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override string ToString(string field) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } @@ -87,30 +87,30 @@ internal sealed class JustCompilePayloadSpans : Spans { public override ICollection GetPayload() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } - public override bool IsPayloadAvailable => throw new NotSupportedException(UNSUPPORTED_MSG); + public override bool IsPayloadAvailable => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); - public override int Doc => throw new NotSupportedException(UNSUPPORTED_MSG); + public override int Doc => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); - public override int End => throw new NotSupportedException(UNSUPPORTED_MSG); + public override int End => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); public override bool MoveNext() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } public override bool SkipTo(int target) { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } - public override int Start => throw new NotSupportedException(UNSUPPORTED_MSG); + public override int Start => throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); public override long GetCost() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } @@ -123,7 +123,7 @@ internal JustCompileSpanScorer(Spans spans, Weight weight, Similarity.SimScorer protected override bool SetFreqCurrentDoc() { - throw new NotSupportedException(UNSUPPORTED_MSG); + throw UnsupportedOperationException.Create(UNSUPPORTED_MSG); } } } diff --git a/src/Lucene.Net.Tests/Search/TestBooleanScorer.cs b/src/Lucene.Net.Tests/Search/TestBooleanScorer.cs index c39e321901..2d365ba6ea 100644 --- a/src/Lucene.Net.Tests/Search/TestBooleanScorer.cs +++ b/src/Lucene.Net.Tests/Search/TestBooleanScorer.cs @@ -255,7 +255,7 @@ public WeightAnonymousClass(CrazyMustUseBulkScorerQuery outerInstance) public override Explanation Explain(AtomicReaderContext context, int doc) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override Query Query => outerInstance; @@ -271,7 +271,7 @@ public override void Normalize(float norm, float topLevelBoost) public override Scorer GetScorer(AtomicReaderContext context, IBits acceptDocs) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override BulkScorer GetBulkScorer(AtomicReaderContext context, bool scoreDocsInOrder, IBits acceptDocs) diff --git a/src/Lucene.Net.Tests/Search/TestElevationComparator.cs b/src/Lucene.Net.Tests/Search/TestElevationComparator.cs index 848fa97bcd..54d5f859a3 100644 --- a/src/Lucene.Net.Tests/Search/TestElevationComparator.cs +++ b/src/Lucene.Net.Tests/Search/TestElevationComparator.cs @@ -188,7 +188,7 @@ public override void SetBottom(int slot) public override void SetTopValue(object value) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } private int DocVal(int doc) @@ -230,7 +230,7 @@ public override FieldComparer SetNextReader(AtomicReaderContext context) public override int CompareTop(int doc) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } diff --git a/src/Lucene.Net/Analysis/CharFilter.cs b/src/Lucene.Net/Analysis/CharFilter.cs index 90d1cf9771..9b08bb282b 100644 --- a/src/Lucene.Net/Analysis/CharFilter.cs +++ b/src/Lucene.Net/Analysis/CharFilter.cs @@ -110,7 +110,7 @@ public override int Read() /// The number of characters actually skipped public virtual long Skip(int n) { - throw new NotSupportedException("Skip() not supported"); + throw UnsupportedOperationException.Create("Skip() not supported"); } /// @@ -119,7 +119,7 @@ public virtual long Skip(int n) /// public virtual void Reset() { - throw new NotSupportedException("Reset() not supported"); + throw UnsupportedOperationException.Create("Reset() not supported"); } /// diff --git a/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs b/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs index 1a85c4bf84..d0025cd77d 100644 --- a/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs +++ b/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs @@ -1472,19 +1472,19 @@ internal void CopyTerm() public override bool SeekExact(BytesRef text) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override void SeekExact(long ord) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } - public override long Ord => throw new NotSupportedException(); + public override long Ord => throw UnsupportedOperationException.Create(); public override SeekStatus SeekCeil(BytesRef text) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } @@ -2582,10 +2582,10 @@ public override TermState GetTermState() public override void SeekExact(long ord) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } - public override long Ord => throw new NotSupportedException(); + public override long Ord => throw UnsupportedOperationException.Create(); // Not static -- references term, postingsReader, // fieldInfo, in diff --git a/src/Lucene.Net/Codecs/Codec.cs b/src/Lucene.Net/Codecs/Codec.cs index 1a26fefee3..6ec8c00746 100644 --- a/src/Lucene.Net/Codecs/Codec.cs +++ b/src/Lucene.Net/Codecs/Codec.cs @@ -1,4 +1,4 @@ -using Lucene.Net.Util; +using Lucene.Net.Util; using System; using System.Collections.Generic; @@ -150,7 +150,7 @@ public static ICollection AvailableCodecs } else { - throw new NotSupportedException("The current CodecFactory class does not implement IServiceListable."); + throw UnsupportedOperationException.Create("The current CodecFactory class does not implement IServiceListable."); } } } diff --git a/src/Lucene.Net/Codecs/Compressing/CompressingTermVectorsReader.cs b/src/Lucene.Net/Codecs/Compressing/CompressingTermVectorsReader.cs index fe7561ac93..c78beb649d 100644 --- a/src/Lucene.Net/Codecs/Compressing/CompressingTermVectorsReader.cs +++ b/src/Lucene.Net/Codecs/Compressing/CompressingTermVectorsReader.cs @@ -910,12 +910,12 @@ public override TermsEnum.SeekStatus SeekCeil(BytesRef text) public override void SeekExact(long ord) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override BytesRef Term => term; - public override long Ord => throw new NotSupportedException(); + public override long Ord => throw UnsupportedOperationException.Create(); public override int DocFreq => 1; diff --git a/src/Lucene.Net/Codecs/DocValuesFormat.cs b/src/Lucene.Net/Codecs/DocValuesFormat.cs index 919855af4b..5fc1993e09 100644 --- a/src/Lucene.Net/Codecs/DocValuesFormat.cs +++ b/src/Lucene.Net/Codecs/DocValuesFormat.cs @@ -158,7 +158,7 @@ public static ICollection AvailableDocValuesFormats } else { - throw new NotSupportedException("The current DocValuesFormatFactory class does not implement IServiceListable."); + throw UnsupportedOperationException.Create("The current DocValuesFormatFactory class does not implement IServiceListable."); } } } diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xCodec.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xCodec.cs index c93d02cc54..d0e4fb4560 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xCodec.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xCodec.cs @@ -69,7 +69,7 @@ public DocValuesFormatAnonymousClass() public override DocValuesConsumer FieldsConsumer(SegmentWriteState state) { - throw new NotSupportedException("this codec cannot write docvalues"); + throw UnsupportedOperationException.Create("this codec cannot write docvalues"); } public override DocValuesProducer FieldsProducer(SegmentReadState state) diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFieldInfosFormat.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFieldInfosFormat.cs index 417eb3268e..6cf3a7d721 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFieldInfosFormat.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFieldInfosFormat.cs @@ -31,6 +31,6 @@ internal class Lucene3xFieldInfosFormat : FieldInfosFormat public override FieldInfosReader FieldInfosReader => reader; - public override FieldInfosWriter FieldInfosWriter => throw new NotSupportedException("this codec can only be used for reading"); + public override FieldInfosWriter FieldInfosWriter => throw UnsupportedOperationException.Create("this codec can only be used for reading"); } } \ No newline at end of file diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs index dc0d5b3a0b..385a1c72a5 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs @@ -817,10 +817,10 @@ public override IComparer Comparer public override void SeekExact(long ord) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } - public override long Ord => throw new NotSupportedException(); + public override long Ord => throw UnsupportedOperationException.Create(); public override SeekStatus SeekCeil(BytesRef term) { diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xNormsFormat.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xNormsFormat.cs index 58432c7777..ccca329394 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xNormsFormat.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xNormsFormat.cs @@ -33,7 +33,7 @@ internal class Lucene3xNormsFormat : NormsFormat { public override DocValuesConsumer NormsConsumer(SegmentWriteState state) { - throw new NotSupportedException("this codec can only be used for reading"); + throw UnsupportedOperationException.Create("this codec can only be used for reading"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xPostingsFormat.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xPostingsFormat.cs index 40c204b7b8..238e2f5ece 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xPostingsFormat.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xPostingsFormat.cs @@ -56,7 +56,7 @@ public Lucene3xPostingsFormat() public override FieldsConsumer FieldsConsumer(SegmentWriteState state) { - throw new NotSupportedException("this codec can only be used for reading"); + throw UnsupportedOperationException.Create("this codec can only be used for reading"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xSegmentInfoFormat.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xSegmentInfoFormat.cs index b3dbf877cf..a1d38258e6 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xSegmentInfoFormat.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xSegmentInfoFormat.cs @@ -59,7 +59,7 @@ public class Lucene3xSegmentInfoFormat : SegmentInfoFormat public override SegmentInfoReader SegmentInfoReader => reader; - public override SegmentInfoWriter SegmentInfoWriter => throw new NotSupportedException("this codec can only be used for reading"); + public override SegmentInfoWriter SegmentInfoWriter => throw UnsupportedOperationException.Create("this codec can only be used for reading"); // only for backwards compat public static readonly string DS_OFFSET_KEY = typeof(Lucene3xSegmentInfoFormat).Name + ".dsoffset"; diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xStoredFieldsFormat.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xStoredFieldsFormat.cs index ef3d6fc663..1653119c2f 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xStoredFieldsFormat.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xStoredFieldsFormat.cs @@ -36,7 +36,7 @@ public override StoredFieldsReader FieldsReader(Directory directory, SegmentInfo public override StoredFieldsWriter FieldsWriter(Directory directory, SegmentInfo si, IOContext context) { - throw new NotSupportedException("this codec can only be used for reading"); + throw UnsupportedOperationException.Create("this codec can only be used for reading"); } } } \ No newline at end of file diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xTermVectorsFormat.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xTermVectorsFormat.cs index 6f4ddbbd3e..49f8ff0876 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xTermVectorsFormat.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xTermVectorsFormat.cs @@ -83,7 +83,7 @@ public override TermVectorsReader VectorsReader(Directory directory, SegmentInfo public override TermVectorsWriter VectorsWriter(Directory directory, SegmentInfo segmentInfo, IOContext context) { - throw new NotSupportedException("this codec can only be used for reading"); + throw UnsupportedOperationException.Create("this codec can only be used for reading"); } } } \ No newline at end of file diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs index 5fb71c447b..65ddaa6459 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs @@ -311,7 +311,7 @@ public bool MoveNext() public void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public void Dispose() @@ -554,7 +554,7 @@ public override SeekStatus SeekCeil(BytesRef text) public override void SeekExact(long ord) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -577,7 +577,7 @@ public override BytesRef Next() public override BytesRef Term => termAndPostings[currentTerm].Term; - public override long Ord => throw new NotSupportedException(); + public override long Ord => throw UnsupportedOperationException.Create(); public override int DocFreq => 1; diff --git a/src/Lucene.Net/Codecs/Lucene3x/SegmentTermPositions.cs b/src/Lucene.Net/Codecs/Lucene3x/SegmentTermPositions.cs index 9515d7dedc..680a486798 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/SegmentTermPositions.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/SegmentTermPositions.cs @@ -150,7 +150,7 @@ public sealed override bool Next() public sealed override int Read(int[] docs, int[] freqs) { - throw new NotSupportedException("TermPositions does not support processing multiple documents in one call. Use TermDocs instead."); + throw UnsupportedOperationException.Create("TermPositions does not support processing multiple documents in one call. Use TermDocs instead."); } /// diff --git a/src/Lucene.Net/Codecs/Lucene40/Lucene40DocValuesFormat.cs b/src/Lucene.Net/Codecs/Lucene40/Lucene40DocValuesFormat.cs index a56cc199e9..5a537522c2 100644 --- a/src/Lucene.Net/Codecs/Lucene40/Lucene40DocValuesFormat.cs +++ b/src/Lucene.Net/Codecs/Lucene40/Lucene40DocValuesFormat.cs @@ -137,7 +137,7 @@ public Lucene40DocValuesFormat() public override DocValuesConsumer FieldsConsumer(SegmentWriteState state) { - throw new NotSupportedException("this codec can only be used for reading"); + throw UnsupportedOperationException.Create("this codec can only be used for reading"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/Lucene.Net/Codecs/Lucene40/Lucene40FieldInfosFormat.cs b/src/Lucene.Net/Codecs/Lucene40/Lucene40FieldInfosFormat.cs index 28681a6165..e99e23d9f6 100644 --- a/src/Lucene.Net/Codecs/Lucene40/Lucene40FieldInfosFormat.cs +++ b/src/Lucene.Net/Codecs/Lucene40/Lucene40FieldInfosFormat.cs @@ -100,7 +100,7 @@ public Lucene40FieldInfosFormat() public override FieldInfosReader FieldInfosReader => reader; - public override FieldInfosWriter FieldInfosWriter => throw new NotSupportedException("this codec can only be used for reading"); + public override FieldInfosWriter FieldInfosWriter => throw UnsupportedOperationException.Create("this codec can only be used for reading"); /// /// Extension of field infos diff --git a/src/Lucene.Net/Codecs/Lucene40/Lucene40NormsFormat.cs b/src/Lucene.Net/Codecs/Lucene40/Lucene40NormsFormat.cs index 2609d8abbf..c1e692b5c9 100644 --- a/src/Lucene.Net/Codecs/Lucene40/Lucene40NormsFormat.cs +++ b/src/Lucene.Net/Codecs/Lucene40/Lucene40NormsFormat.cs @@ -49,7 +49,7 @@ public Lucene40NormsFormat() public override DocValuesConsumer NormsConsumer(SegmentWriteState state) { - throw new NotSupportedException("this codec can only be used for reading"); + throw UnsupportedOperationException.Create("this codec can only be used for reading"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/Lucene.Net/Codecs/Lucene40/Lucene40PostingsBaseFormat.cs b/src/Lucene.Net/Codecs/Lucene40/Lucene40PostingsBaseFormat.cs index e6b887340d..5cc580ca66 100644 --- a/src/Lucene.Net/Codecs/Lucene40/Lucene40PostingsBaseFormat.cs +++ b/src/Lucene.Net/Codecs/Lucene40/Lucene40PostingsBaseFormat.cs @@ -46,7 +46,7 @@ public override PostingsReaderBase PostingsReaderBase(SegmentReadState state) public override PostingsWriterBase PostingsWriterBase(SegmentWriteState state) { - throw new NotSupportedException("this codec can only be used for reading"); + throw UnsupportedOperationException.Create("this codec can only be used for reading"); } } } \ No newline at end of file diff --git a/src/Lucene.Net/Codecs/Lucene40/Lucene40PostingsFormat.cs b/src/Lucene.Net/Codecs/Lucene40/Lucene40PostingsFormat.cs index 804b7d7bd2..5df448c578 100644 --- a/src/Lucene.Net/Codecs/Lucene40/Lucene40PostingsFormat.cs +++ b/src/Lucene.Net/Codecs/Lucene40/Lucene40PostingsFormat.cs @@ -240,7 +240,7 @@ private Lucene40PostingsFormat(int minBlockSize, int maxBlockSize) public override FieldsConsumer FieldsConsumer(SegmentWriteState state) { - throw new NotSupportedException("this codec can only be used for reading"); + throw UnsupportedOperationException.Create("this codec can only be used for reading"); } public override FieldsProducer FieldsProducer(SegmentReadState state) diff --git a/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsReader.cs b/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsReader.cs index 897271f7b5..5994411702 100644 --- a/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsReader.cs +++ b/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsReader.cs @@ -473,7 +473,7 @@ public override SeekStatus SeekCeil(BytesRef text) public override void SeekExact(long ord) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override bool MoveNext() @@ -554,7 +554,7 @@ public override BytesRef Next() public override BytesRef Term => term; - public override long Ord => throw new NotSupportedException(); + public override long Ord => throw UnsupportedOperationException.Create(); public override int DocFreq => 1; diff --git a/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsWriter.cs b/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsWriter.cs index 1240848be1..49da6db833 100644 --- a/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsWriter.cs +++ b/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsWriter.cs @@ -317,7 +317,7 @@ private void WritePosition(int delta, BytesRef payload) { // we overflowed the payload buffer, just throw UOE // having > System.Int32.MaxValue bytes of payload for a single term in a single doc is nuts. - throw new NotSupportedException("A term cannot have more than System.Int32.MaxValue bytes of payload data in a single document"); + throw UnsupportedOperationException.Create("A term cannot have more than System.Int32.MaxValue bytes of payload data in a single document"); } payloadData.Append(payload); } diff --git a/src/Lucene.Net/Codecs/Lucene41/Lucene41Codec.cs b/src/Lucene.Net/Codecs/Lucene41/Lucene41Codec.cs index bafd126a63..193d31a28d 100644 --- a/src/Lucene.Net/Codecs/Lucene41/Lucene41Codec.cs +++ b/src/Lucene.Net/Codecs/Lucene41/Lucene41Codec.cs @@ -59,7 +59,7 @@ public CompressingStoredFieldsFormatAnonymousClass(string formatName, Compressio public override StoredFieldsWriter FieldsWriter(Directory directory, SegmentInfo si, IOContext context) { - throw new NotSupportedException("this codec can only be used for reading"); + throw UnsupportedOperationException.Create("this codec can only be used for reading"); } } diff --git a/src/Lucene.Net/Codecs/Lucene42/Lucene42Codec.cs b/src/Lucene.Net/Codecs/Lucene42/Lucene42Codec.cs index 747b305255..4d5020df42 100644 --- a/src/Lucene.Net/Codecs/Lucene42/Lucene42Codec.cs +++ b/src/Lucene.Net/Codecs/Lucene42/Lucene42Codec.cs @@ -154,7 +154,7 @@ private class Lucene42NormsFormatAnonymousClass : Lucene42NormsFormat { public override DocValuesConsumer NormsConsumer(SegmentWriteState state) { - throw new NotSupportedException("this codec can only be used for reading"); + throw UnsupportedOperationException.Create("this codec can only be used for reading"); } } diff --git a/src/Lucene.Net/Codecs/Lucene42/Lucene42DocValuesFormat.cs b/src/Lucene.Net/Codecs/Lucene42/Lucene42DocValuesFormat.cs index 005eb00f8d..eafdbf5c3d 100644 --- a/src/Lucene.Net/Codecs/Lucene42/Lucene42DocValuesFormat.cs +++ b/src/Lucene.Net/Codecs/Lucene42/Lucene42DocValuesFormat.cs @@ -153,7 +153,7 @@ public Lucene42DocValuesFormat(float acceptableOverheadRatio) public override DocValuesConsumer FieldsConsumer(SegmentWriteState state) { - throw new NotSupportedException("this codec can only be used for reading"); + throw UnsupportedOperationException.Create("this codec can only be used for reading"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/Lucene.Net/Codecs/Lucene42/Lucene42DocValuesProducer.cs b/src/Lucene.Net/Codecs/Lucene42/Lucene42DocValuesProducer.cs index 4b643dcd66..e7e85dd8c6 100644 --- a/src/Lucene.Net/Codecs/Lucene42/Lucene42DocValuesProducer.cs +++ b/src/Lucene.Net/Codecs/Lucene42/Lucene42DocValuesProducer.cs @@ -796,18 +796,18 @@ public override void SeekExact(long ord) public override long Ord => @in.Current.Output.GetValueOrDefault(); - public override int DocFreq => throw new NotSupportedException(); + public override int DocFreq => throw UnsupportedOperationException.Create(); - public override long TotalTermFreq => throw new NotSupportedException(); + public override long TotalTermFreq => throw UnsupportedOperationException.Create(); public override DocsEnum Docs(IBits liveDocs, DocsEnum reuse, DocsFlags flags) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } diff --git a/src/Lucene.Net/Codecs/Lucene42/Lucene42FieldInfosFormat.cs b/src/Lucene.Net/Codecs/Lucene42/Lucene42FieldInfosFormat.cs index d961a561d0..e2f93a9300 100644 --- a/src/Lucene.Net/Codecs/Lucene42/Lucene42FieldInfosFormat.cs +++ b/src/Lucene.Net/Codecs/Lucene42/Lucene42FieldInfosFormat.cs @@ -90,7 +90,7 @@ public Lucene42FieldInfosFormat() public override FieldInfosReader FieldInfosReader => reader; - public override FieldInfosWriter FieldInfosWriter => throw new NotSupportedException("this codec can only be used for reading"); + public override FieldInfosWriter FieldInfosWriter => throw UnsupportedOperationException.Create("this codec can only be used for reading"); /// /// Extension of field infos. diff --git a/src/Lucene.Net/Codecs/Lucene42/Lucene42NormsConsumer.cs b/src/Lucene.Net/Codecs/Lucene42/Lucene42NormsConsumer.cs index b949414580..73e62e4285 100644 --- a/src/Lucene.Net/Codecs/Lucene42/Lucene42NormsConsumer.cs +++ b/src/Lucene.Net/Codecs/Lucene42/Lucene42NormsConsumer.cs @@ -235,17 +235,17 @@ protected override void Dispose(bool disposing) public override void AddBinaryField(FieldInfo field, IEnumerable values) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override void AddSortedField(FieldInfo field, IEnumerable values, IEnumerable docToOrd) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override void AddSortedSetField(FieldInfo field, IEnumerable values, IEnumerable docToOrdCount, IEnumerable ords) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } \ No newline at end of file diff --git a/src/Lucene.Net/Codecs/Lucene45/Lucene45DocValuesProducer.cs b/src/Lucene.Net/Codecs/Lucene45/Lucene45DocValuesProducer.cs index 0b473684f8..b13cabff89 100644 --- a/src/Lucene.Net/Codecs/Lucene45/Lucene45DocValuesProducer.cs +++ b/src/Lucene.Net/Codecs/Lucene45/Lucene45DocValuesProducer.cs @@ -1222,18 +1222,18 @@ private void SetTerm() public override IComparer Comparer => BytesRef.UTF8SortedAsUnicodeComparer; - public override int DocFreq => throw new NotSupportedException(); + public override int DocFreq => throw UnsupportedOperationException.Create(); public override long TotalTermFreq => -1; public override DocsEnum Docs(IBits liveDocs, DocsEnum reuse, DocsFlags flags) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } diff --git a/src/Lucene.Net/Codecs/MappingMultiDocsAndPositionsEnum.cs b/src/Lucene.Net/Codecs/MappingMultiDocsAndPositionsEnum.cs index fc5622c655..9c5ee8a10e 100644 --- a/src/Lucene.Net/Codecs/MappingMultiDocsAndPositionsEnum.cs +++ b/src/Lucene.Net/Codecs/MappingMultiDocsAndPositionsEnum.cs @@ -87,7 +87,7 @@ public MergeState MergeState public override int Advance(int target) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override int NextDoc() diff --git a/src/Lucene.Net/Codecs/MappingMultiDocsEnum.cs b/src/Lucene.Net/Codecs/MappingMultiDocsEnum.cs index 7a61290e2b..b933a495ec 100644 --- a/src/Lucene.Net/Codecs/MappingMultiDocsEnum.cs +++ b/src/Lucene.Net/Codecs/MappingMultiDocsEnum.cs @@ -86,7 +86,7 @@ public MergeState MergeState public override int Advance(int target) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override int NextDoc() diff --git a/src/Lucene.Net/Codecs/PostingsFormat.cs b/src/Lucene.Net/Codecs/PostingsFormat.cs index a315a2e133..4824deff7e 100644 --- a/src/Lucene.Net/Codecs/PostingsFormat.cs +++ b/src/Lucene.Net/Codecs/PostingsFormat.cs @@ -155,7 +155,7 @@ public static ICollection AvailablePostingsFormats } else { - throw new NotSupportedException("The current PostingsFormat factory class does not implement IServiceListable."); + throw UnsupportedOperationException.Create("The current PostingsFormat factory class does not implement IServiceListable."); } } } diff --git a/src/Lucene.Net/Index/AtomicReaderContext.cs b/src/Lucene.Net/Index/AtomicReaderContext.cs index ffa83bfed0..a3cffb1dec 100644 --- a/src/Lucene.Net/Index/AtomicReaderContext.cs +++ b/src/Lucene.Net/Index/AtomicReaderContext.cs @@ -61,7 +61,7 @@ public override IList Leaves { if (!IsTopLevel) { - throw new NotSupportedException("this is not a top-level context."); + throw UnsupportedOperationException.Create("this is not a top-level context."); } if (Debugging.AssertsEnabled) Debugging.Assert(leaves != null); return leaves; diff --git a/src/Lucene.Net/Index/CoalescedUpdates.cs b/src/Lucene.Net/Index/CoalescedUpdates.cs index 6394052eb3..2d74fe564c 100644 --- a/src/Lucene.Net/Index/CoalescedUpdates.cs +++ b/src/Lucene.Net/Index/CoalescedUpdates.cs @@ -150,7 +150,7 @@ public bool MoveNext() public void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public QueryAndLimit Current => current; diff --git a/src/Lucene.Net/Index/CompositeReaderContext.cs b/src/Lucene.Net/Index/CompositeReaderContext.cs index f0f28ab56a..5b4be75f1c 100644 --- a/src/Lucene.Net/Index/CompositeReaderContext.cs +++ b/src/Lucene.Net/Index/CompositeReaderContext.cs @@ -68,7 +68,7 @@ public override IList Leaves { if (!IsTopLevel) { - throw new NotSupportedException("this is not a top-level context."); + throw UnsupportedOperationException.Create("this is not a top-level context."); } if (Debugging.AssertsEnabled) Debugging.Assert(leaves != null); return leaves; diff --git a/src/Lucene.Net/Index/DocInverterPerField.cs b/src/Lucene.Net/Index/DocInverterPerField.cs index 1eac2d1171..97e91f3bbe 100644 --- a/src/Lucene.Net/Index/DocInverterPerField.cs +++ b/src/Lucene.Net/Index/DocInverterPerField.cs @@ -83,7 +83,7 @@ public override void ProcessFields(IIndexableField[] fields, int count) // if the field omits norms, the boost cannot be indexed. if (fieldType.OmitNorms && field.Boost != 1.0f) { - throw new NotSupportedException("You cannot set an index-time boost: norms are omitted for field '" + field.Name + "'"); + throw UnsupportedOperationException.Create("You cannot set an index-time boost: norms are omitted for field '" + field.Name + "'"); } // only bother checking offsets if something will consume them. diff --git a/src/Lucene.Net/Index/DocumentsWriterFlushControl.cs b/src/Lucene.Net/Index/DocumentsWriterFlushControl.cs index d424545f0f..8a23eacdde 100644 --- a/src/Lucene.Net/Index/DocumentsWriterFlushControl.cs +++ b/src/Lucene.Net/Index/DocumentsWriterFlushControl.cs @@ -539,7 +539,7 @@ public bool MoveNext() public void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } diff --git a/src/Lucene.Net/Index/FilteredTermsEnum.cs b/src/Lucene.Net/Index/FilteredTermsEnum.cs index f41fc441b5..0938130ff0 100644 --- a/src/Lucene.Net/Index/FilteredTermsEnum.cs +++ b/src/Lucene.Net/Index/FilteredTermsEnum.cs @@ -160,7 +160,7 @@ protected virtual BytesRef NextSeekTerm(BytesRef currentTerm) /// support seeking. public override bool SeekExact(BytesRef term) { - throw new NotSupportedException(this.GetType().Name + " does not support seeking"); + throw UnsupportedOperationException.Create(this.GetType().Name + " does not support seeking"); } /// @@ -169,7 +169,7 @@ public override bool SeekExact(BytesRef term) /// support seeking. public override SeekStatus SeekCeil(BytesRef term) { - throw new NotSupportedException(this.GetType().Name + " does not support seeking"); + throw UnsupportedOperationException.Create(this.GetType().Name + " does not support seeking"); } /// @@ -178,7 +178,7 @@ public override SeekStatus SeekCeil(BytesRef term) /// support seeking. public override void SeekExact(long ord) { - throw new NotSupportedException(this.GetType().Name + " does not support seeking"); + throw UnsupportedOperationException.Create(this.GetType().Name + " does not support seeking"); } public override long Ord => tenum.Ord; @@ -199,7 +199,7 @@ public override DocsAndPositionsEnum DocsAndPositions(IBits bits, DocsAndPositio /// support seeking. public override void SeekExact(BytesRef term, TermState state) { - throw new NotSupportedException(this.GetType().Name + " does not support seeking"); + throw UnsupportedOperationException.Create(this.GetType().Name + " does not support seeking"); } /// diff --git a/src/Lucene.Net/Index/FrozenBufferedUpdates.cs b/src/Lucene.Net/Index/FrozenBufferedUpdates.cs index 3a242f3862..8c66984ca0 100644 --- a/src/Lucene.Net/Index/FrozenBufferedUpdates.cs +++ b/src/Lucene.Net/Index/FrozenBufferedUpdates.cs @@ -232,7 +232,7 @@ public virtual bool MoveNext() public virtual void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public void Dispose() diff --git a/src/Lucene.Net/Index/IndexCommit.cs b/src/Lucene.Net/Index/IndexCommit.cs index c49cff630b..3caabec528 100644 --- a/src/Lucene.Net/Index/IndexCommit.cs +++ b/src/Lucene.Net/Index/IndexCommit.cs @@ -127,7 +127,7 @@ public virtual int CompareTo(IndexCommit commit) { if (Directory != commit.Directory) { - throw new NotSupportedException("cannot compare IndexCommits from different Directory instances"); + throw UnsupportedOperationException.Create("cannot compare IndexCommits from different Directory instances"); } long gen = Generation; diff --git a/src/Lucene.Net/Index/MultiTermsEnum.cs b/src/Lucene.Net/Index/MultiTermsEnum.cs index 73cb678c1f..adedf215e9 100644 --- a/src/Lucene.Net/Index/MultiTermsEnum.cs +++ b/src/Lucene.Net/Index/MultiTermsEnum.cs @@ -1,4 +1,4 @@ -using Lucene.Net.Diagnostics; +using Lucene.Net.Diagnostics; using Lucene.Net.Support; using System; using System.Collections.Generic; @@ -318,10 +318,10 @@ public override SeekStatus SeekCeil(BytesRef term) public override void SeekExact(long ord) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } - public override long Ord => throw new NotSupportedException(); + public override long Ord => throw UnsupportedOperationException.Create(); private void PullTop() { diff --git a/src/Lucene.Net/Index/PrefixCodedTerms.cs b/src/Lucene.Net/Index/PrefixCodedTerms.cs index 16fa11ade9..345415457a 100644 --- a/src/Lucene.Net/Index/PrefixCodedTerms.cs +++ b/src/Lucene.Net/Index/PrefixCodedTerms.cs @@ -133,7 +133,7 @@ public virtual bool MoveNext() public virtual void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } diff --git a/src/Lucene.Net/Index/SortedDocValuesTermsEnum.cs b/src/Lucene.Net/Index/SortedDocValuesTermsEnum.cs index 157673aff0..8b7e8dbf7e 100644 --- a/src/Lucene.Net/Index/SortedDocValuesTermsEnum.cs +++ b/src/Lucene.Net/Index/SortedDocValuesTermsEnum.cs @@ -122,18 +122,18 @@ public override BytesRef Next() public override long Ord => currentOrd; - public override int DocFreq => throw new NotSupportedException(); + public override int DocFreq => throw UnsupportedOperationException.Create(); public override long TotalTermFreq => -1; public override DocsEnum Docs(IBits liveDocs, DocsEnum reuse, DocsFlags flags) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override IComparer Comparer => BytesRef.UTF8SortedAsUnicodeComparer; diff --git a/src/Lucene.Net/Index/SortedSetDocValuesTermsEnum.cs b/src/Lucene.Net/Index/SortedSetDocValuesTermsEnum.cs index 3aec7036fd..1f51b6e940 100644 --- a/src/Lucene.Net/Index/SortedSetDocValuesTermsEnum.cs +++ b/src/Lucene.Net/Index/SortedSetDocValuesTermsEnum.cs @@ -122,18 +122,18 @@ public override BytesRef Next() public override long Ord => currentOrd; - public override int DocFreq => throw new NotSupportedException(); + public override int DocFreq => throw UnsupportedOperationException.Create(); public override long TotalTermFreq => -1; public override DocsEnum Docs(IBits liveDocs, DocsEnum reuse, DocsFlags flags) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override IComparer Comparer => BytesRef.UTF8SortedAsUnicodeComparer; diff --git a/src/Lucene.Net/Index/StandardDirectoryReader.cs b/src/Lucene.Net/Index/StandardDirectoryReader.cs index 45fb0cdbdb..6a7dd210ea 100644 --- a/src/Lucene.Net/Index/StandardDirectoryReader.cs +++ b/src/Lucene.Net/Index/StandardDirectoryReader.cs @@ -543,7 +543,7 @@ public override string ToString() public override void Delete() { - throw new NotSupportedException("this IndexCommit does not support deletions"); + throw UnsupportedOperationException.Create("this IndexCommit does not support deletions"); } } } diff --git a/src/Lucene.Net/Index/TermsEnum.cs b/src/Lucene.Net/Index/TermsEnum.cs index fdfaea5fad..c185b93e56 100644 --- a/src/Lucene.Net/Index/TermsEnum.cs +++ b/src/Lucene.Net/Index/TermsEnum.cs @@ -1,4 +1,4 @@ -using Lucene.Net.Util; +using Lucene.Net.Util; using System; using System.Collections.Generic; using System.ComponentModel; @@ -275,7 +275,7 @@ private class TermStateAnonymousClass : TermState { public override void CopyFrom(TermState other) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } diff --git a/src/Lucene.Net/Lucene.Net.csproj b/src/Lucene.Net/Lucene.Net.csproj index 75ff9f69a0..0bb541a19f 100644 --- a/src/Lucene.Net/Lucene.Net.csproj +++ b/src/Lucene.Net/Lucene.Net.csproj @@ -105,6 +105,7 @@ + diff --git a/src/Lucene.Net/Search/CachingCollector.cs b/src/Lucene.Net/Search/CachingCollector.cs index d00e9117d8..7cbdc7a1ef 100644 --- a/src/Lucene.Net/Search/CachingCollector.cs +++ b/src/Lucene.Net/Search/CachingCollector.cs @@ -93,16 +93,16 @@ public override float GetScore() public override int Advance(int target) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override int DocID => doc; - public override int Freq => throw new NotSupportedException(); + public override int Freq => throw UnsupportedOperationException.Create(); public override int NextDoc() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override long GetCost() diff --git a/src/Lucene.Net/Search/FakeScorer.cs b/src/Lucene.Net/Search/FakeScorer.cs index 637551d85f..477ba4e2b6 100644 --- a/src/Lucene.Net/Search/FakeScorer.cs +++ b/src/Lucene.Net/Search/FakeScorer.cs @@ -37,7 +37,7 @@ public FakeScorer() public override int Advance(int target) { - throw new NotSupportedException("FakeScorer doesn't support advance(int)"); + throw UnsupportedOperationException.Create("FakeScorer doesn't support advance(int)"); } public override int DocID => doc; @@ -46,7 +46,7 @@ public override int Advance(int target) public override int NextDoc() { - throw new NotSupportedException("FakeScorer doesn't support nextDoc()"); + throw UnsupportedOperationException.Create("FakeScorer doesn't support nextDoc()"); } public override float GetScore() @@ -59,11 +59,11 @@ public override long GetCost() return 1; } - public override Weight Weight => throw new NotSupportedException(); + public override Weight Weight => throw UnsupportedOperationException.Create(); public override ICollection GetChildren() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } \ No newline at end of file diff --git a/src/Lucene.Net/Search/FuzzyTermsEnum.cs b/src/Lucene.Net/Search/FuzzyTermsEnum.cs index 41f51c0411..c28eeeb98b 100644 --- a/src/Lucene.Net/Search/FuzzyTermsEnum.cs +++ b/src/Lucene.Net/Search/FuzzyTermsEnum.cs @@ -152,7 +152,7 @@ public FuzzyTermsEnum(Terms terms, AttributeSource atts, Term term, float minSim } if (transpositions && m_maxEdits > LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE) { - throw new NotSupportedException("with transpositions enabled, distances > " + LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE + " are not supported "); + throw UnsupportedOperationException.Create("with transpositions enabled, distances > " + LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE + " are not supported "); } this.transpositions = transpositions; this.m_scaleFactor = 1.0f / (1.0f - this.m_minSimilarity); diff --git a/src/Lucene.Net/Search/IndexSearcher.cs b/src/Lucene.Net/Search/IndexSearcher.cs index 60fe4c08c0..50e921322f 100644 --- a/src/Lucene.Net/Search/IndexSearcher.cs +++ b/src/Lucene.Net/Search/IndexSearcher.cs @@ -863,7 +863,7 @@ public void Submit(ICallable task) public void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public bool MoveNext() diff --git a/src/Lucene.Net/Search/MultiTermQuery.cs b/src/Lucene.Net/Search/MultiTermQuery.cs index 80235ba165..583861b772 100644 --- a/src/Lucene.Net/Search/MultiTermQuery.cs +++ b/src/Lucene.Net/Search/MultiTermQuery.cs @@ -253,13 +253,13 @@ public ConstantScoreAutoRewriteAnonymousClass() public override int TermCountCutoff { get => base.TermCountCutoff; // LUCENENET specific - adding getter for API consistency check - set => throw new NotSupportedException("Please create a private instance"); + set => throw UnsupportedOperationException.Create("Please create a private instance"); } public override double DocCountPercent { get => base.DocCountPercent; // LUCENENET specific - adding getter for API consistency check - set => throw new NotSupportedException("Please create a private instance"); + set => throw UnsupportedOperationException.Create("Please create a private instance"); } } diff --git a/src/Lucene.Net/Search/Query.cs b/src/Lucene.Net/Search/Query.cs index f19fb021ad..47759c791a 100644 --- a/src/Lucene.Net/Search/Query.cs +++ b/src/Lucene.Net/Search/Query.cs @@ -86,7 +86,7 @@ public override string ToString() /// public virtual Weight CreateWeight(IndexSearcher searcher) { - throw new NotSupportedException("Query " + this + " does not implement createWeight"); + throw UnsupportedOperationException.Create("Query " + this + " does not implement createWeight"); } /// @@ -107,7 +107,7 @@ public virtual Query Rewrite(IndexReader reader) public virtual void ExtractTerms(ISet terms) { // needs to be implemented by query subclasses - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// diff --git a/src/Lucene.Net/Search/Spans/SpanMultiTermQueryWrapper.cs b/src/Lucene.Net/Search/Spans/SpanMultiTermQueryWrapper.cs index 453fe22ef4..c48e5d7295 100644 --- a/src/Lucene.Net/Search/Spans/SpanMultiTermQueryWrapper.cs +++ b/src/Lucene.Net/Search/Spans/SpanMultiTermQueryWrapper.cs @@ -80,7 +80,7 @@ public SpanRewriteMethod MultiTermRewriteMethod MultiTermQuery.RewriteMethod m = m_query.MultiTermRewriteMethod; if (!(m is SpanRewriteMethod spanRewriteMethod)) { - throw new NotSupportedException("You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."); + throw UnsupportedOperationException.Create("You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."); } return spanRewriteMethod; } @@ -89,7 +89,7 @@ public SpanRewriteMethod MultiTermRewriteMethod public override Spans GetSpans(AtomicReaderContext context, IBits acceptDocs, IDictionary termContexts) { - throw new NotSupportedException("Query should have been rewritten"); + throw UnsupportedOperationException.Create("Query should have been rewritten"); } public override string Field => m_query.Field; @@ -117,7 +117,7 @@ public override Query Rewrite(IndexReader reader) Query q = m_query.Rewrite(reader); if (!(q is SpanQuery)) { - throw new NotSupportedException("You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."); + throw UnsupportedOperationException.Create("You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."); } q.Boost = q.Boost * Boost; // multiply boost return q; diff --git a/src/Lucene.Net/Store/BufferedChecksumIndexInput.cs b/src/Lucene.Net/Store/BufferedChecksumIndexInput.cs index 639a7549eb..9353650548 100644 --- a/src/Lucene.Net/Store/BufferedChecksumIndexInput.cs +++ b/src/Lucene.Net/Store/BufferedChecksumIndexInput.cs @@ -70,7 +70,7 @@ public override long GetFilePointer() public override object Clone() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } \ No newline at end of file diff --git a/src/Lucene.Net/Store/CompoundFileDirectory.cs b/src/Lucene.Net/Store/CompoundFileDirectory.cs index 3369118c1a..57650456ab 100644 --- a/src/Lucene.Net/Store/CompoundFileDirectory.cs +++ b/src/Lucene.Net/Store/CompoundFileDirectory.cs @@ -366,7 +366,7 @@ public override bool FileExists(string name) /// always: not supported by CFS public override void DeleteFile(string name) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -376,7 +376,7 @@ public override void DeleteFile(string name) public void RenameFile(string from, string to) #pragma warning restore IDE0060, CA1822 // Remove unused parameter, Mark members as static { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -405,7 +405,7 @@ public override IndexOutput CreateOutput(string name, IOContext context) public override void Sync(ICollection names) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -413,7 +413,7 @@ public override void Sync(ICollection names) /// always: not supported by CFS public override Lock MakeLock(string name) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public override IndexInputSlicer CreateSlicer(string name, IOContext context) diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/UnsupportedOperationException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/UnsupportedOperationException.cs index 29f19d479f..4d2f872635 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/UnsupportedOperationException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/UnsupportedOperationException.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.CompilerServices; using System.Runtime.Serialization; namespace Lucene @@ -39,18 +40,22 @@ namespace Lucene #endif internal class UnsupportedOperationException : NotSupportedException { + [Obsolete("Use UnsupportedOperationException.Create() instead.", error: true)] public UnsupportedOperationException() { } + [Obsolete("Use UnsupportedOperationException.Create() instead.", error: true)] public UnsupportedOperationException(string message) : base(message) { } + [Obsolete("Use UnsupportedOperationException.Create() instead.", error: true)] public UnsupportedOperationException(string message, Exception innerException) : base(message, innerException) { } + [Obsolete("Use UnsupportedOperationException.Create() instead.", error: true)] public UnsupportedOperationException(Exception cause) : base(cause?.ToString(), cause) { @@ -67,5 +72,22 @@ protected UnsupportedOperationException(SerializationInfo info, StreamingContext { } #endif + + // Static factory methods + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Exception Create() => new NotSupportedException(); + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Exception Create(string message) => new NotSupportedException(message); + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Exception Create(string message, Exception innerException) => new NotSupportedException(message, innerException); + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Exception Create(Exception cause) => new NotSupportedException(cause.Message, cause); } } diff --git a/src/Lucene.Net/Util/AttributeImpl.cs b/src/Lucene.Net/Util/AttributeImpl.cs index 5c9df2f390..c75e78613b 100644 --- a/src/Lucene.Net/Util/AttributeImpl.cs +++ b/src/Lucene.Net/Util/AttributeImpl.cs @@ -125,7 +125,7 @@ public virtual void ReflectWith(IAttributeReflector reflector) // LUCENENET NOTE if (interfaces.Count != 1) { - throw new NotSupportedException(clazz.Name + " implements more than one Attribute interface, the default ReflectWith() implementation cannot handle this."); + throw UnsupportedOperationException.Create(clazz.Name + " implements more than one Attribute interface, the default ReflectWith() implementation cannot handle this."); } interfaces.First.Value.TryGetTarget(out Type interf); diff --git a/src/Lucene.Net/Util/AttributeSource.cs b/src/Lucene.Net/Util/AttributeSource.cs index 7bd63b386f..cda26f44a7 100644 --- a/src/Lucene.Net/Util/AttributeSource.cs +++ b/src/Lucene.Net/Util/AttributeSource.cs @@ -274,7 +274,7 @@ public IteratorAnonymousClass(AttributeSource.State initState) //public virtual void Remove() // LUCENENET specific - not used //{ - // throw new NotSupportedException(); + // throw UnsupportedOperationException.Create(); //} public void Dispose() @@ -296,7 +296,7 @@ public bool MoveNext() public void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public Attribute Current => current; diff --git a/src/Lucene.Net/Util/Automaton/Automaton.cs b/src/Lucene.Net/Util/Automaton/Automaton.cs index 2842cc29c3..8132c6d18f 100644 --- a/src/Lucene.Net/Util/Automaton/Automaton.cs +++ b/src/Lucene.Net/Util/Automaton/Automaton.cs @@ -617,9 +617,12 @@ public virtual int GetNumberOfTransitions() [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) { - var other = obj as Automaton; - return BasicOperations.SameLanguage(this, other); - //throw new NotSupportedException("use BasicOperations.sameLanguage instead"); + if (obj is Automaton other) + return BasicOperations.SameLanguage(this, other); + return false; + + // LUCENENET specific - need an Equals implementation for collection equality checking + //throw UnsupportedOperationException.Create("use BasicOperations.sameLanguage instead"); } // LUCENENET specific - in .NET, we can't simply throw an exception here because @@ -667,7 +670,7 @@ public override int GetHashCode() } return hash; - //throw new NotSupportedException(); + //throw UnsupportedOperationException.Create(); } ///// diff --git a/src/Lucene.Net/Util/Automaton/State.cs b/src/Lucene.Net/Util/Automaton/State.cs index 36f08d0f26..4a7e7cdfa8 100644 --- a/src/Lucene.Net/Util/Automaton/State.cs +++ b/src/Lucene.Net/Util/Automaton/State.cs @@ -127,7 +127,7 @@ public bool MoveNext() public void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public void Dispose() diff --git a/src/Lucene.Net/Util/Fst/Outputs.cs b/src/Lucene.Net/Util/Fst/Outputs.cs index 634faf54c8..efe852d94f 100644 --- a/src/Lucene.Net/Util/Fst/Outputs.cs +++ b/src/Lucene.Net/Util/Fst/Outputs.cs @@ -102,7 +102,7 @@ public virtual T ReadFinalOutput(DataInput @in) [MethodImpl(MethodImplOptions.NoInlining)] public virtual T Merge(T first, T second) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } } } \ No newline at end of file diff --git a/src/Lucene.Net/Util/MergedIterator.cs b/src/Lucene.Net/Util/MergedIterator.cs index 2216c7563d..99860a073a 100644 --- a/src/Lucene.Net/Util/MergedIterator.cs +++ b/src/Lucene.Net/Util/MergedIterator.cs @@ -109,7 +109,7 @@ public bool MoveNext() public void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public void Dispose() @@ -271,7 +271,7 @@ public bool MoveNext() public void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public void Dispose() diff --git a/src/Lucene.Net/Util/NumericUtils.cs b/src/Lucene.Net/Util/NumericUtils.cs index 91f95beb88..3cc67cde02 100644 --- a/src/Lucene.Net/Util/NumericUtils.cs +++ b/src/Lucene.Net/Util/NumericUtils.cs @@ -491,7 +491,7 @@ public abstract class Int64RangeBuilder /// public virtual void AddRange(BytesRef minPrefixCoded, BytesRef maxPrefixCoded) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// @@ -524,7 +524,7 @@ public abstract class Int32RangeBuilder /// public virtual void AddRange(BytesRef minPrefixCoded, BytesRef maxPrefixCoded) { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } /// diff --git a/src/Lucene.Net/Util/Packed/BulkOperationPacked.cs b/src/Lucene.Net/Util/Packed/BulkOperationPacked.cs index af043856de..156401162b 100644 --- a/src/Lucene.Net/Util/Packed/BulkOperationPacked.cs +++ b/src/Lucene.Net/Util/Packed/BulkOperationPacked.cs @@ -133,7 +133,7 @@ public override void Decode(long[] blocks, int blocksOffset, int[] values, int v { if (bitsPerValue > 32) { - throw new NotSupportedException("Cannot decode " + bitsPerValue + "-bits values into an int[]"); + throw UnsupportedOperationException.Create("Cannot decode " + bitsPerValue + "-bits values into an int[]"); } int bitsLeft = 64; for (int i = 0; i < longValueCount * iterations; ++i) diff --git a/src/Lucene.Net/Util/Packed/BulkOperationPackedSingleBlock.cs b/src/Lucene.Net/Util/Packed/BulkOperationPackedSingleBlock.cs index b09fcbf7d8..c802883214 100644 --- a/src/Lucene.Net/Util/Packed/BulkOperationPackedSingleBlock.cs +++ b/src/Lucene.Net/Util/Packed/BulkOperationPackedSingleBlock.cs @@ -128,7 +128,7 @@ public override void Decode(long[] blocks, int blocksOffset, int[] values, int v { if (bitsPerValue > 32) { - throw new NotSupportedException("Cannot decode " + bitsPerValue + "-bits values into an int[]"); + throw UnsupportedOperationException.Create("Cannot decode " + bitsPerValue + "-bits values into an int[]"); } for (int i = 0; i < iterations; ++i) { @@ -141,7 +141,7 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v { if (bitsPerValue > 32) { - throw new NotSupportedException("Cannot decode " + bitsPerValue + "-bits values into an int[]"); + throw UnsupportedOperationException.Create("Cannot decode " + bitsPerValue + "-bits values into an int[]"); } for (int i = 0; i < iterations; ++i) { diff --git a/src/Lucene.Net/Util/Packed/EliasFanoDocIdSet.cs b/src/Lucene.Net/Util/Packed/EliasFanoDocIdSet.cs index bf79801a1f..8e702c2c54 100644 --- a/src/Lucene.Net/Util/Packed/EliasFanoDocIdSet.cs +++ b/src/Lucene.Net/Util/Packed/EliasFanoDocIdSet.cs @@ -77,7 +77,7 @@ public override DocIdSetIterator GetIterator() { if (efEncoder.lastEncoded >= DocIdSetIterator.NO_MORE_DOCS) { - throw new NotSupportedException("Highest encoded value too high for DocIdSetIterator.NO_MORE_DOCS: " + efEncoder.lastEncoded); + throw UnsupportedOperationException.Create("Highest encoded value too high for DocIdSetIterator.NO_MORE_DOCS: " + efEncoder.lastEncoded); } return new DocIdSetIteratorAnonymousClass(this); } diff --git a/src/Lucene.Net/Util/RamUsageEstimator.cs b/src/Lucene.Net/Util/RamUsageEstimator.cs index 294efc8d94..8cabaa33a6 100644 --- a/src/Lucene.Net/Util/RamUsageEstimator.cs +++ b/src/Lucene.Net/Util/RamUsageEstimator.cs @@ -1036,7 +1036,7 @@ private object FetchNext() public void Reset() { - throw new NotSupportedException(); + throw UnsupportedOperationException.Create(); } public void Dispose() diff --git a/src/Lucene.Net/Util/VirtualMethod.cs b/src/Lucene.Net/Util/VirtualMethod.cs index 5ae56d79e9..f91b10bf6c 100644 --- a/src/Lucene.Net/Util/VirtualMethod.cs +++ b/src/Lucene.Net/Util/VirtualMethod.cs @@ -131,7 +131,7 @@ public VirtualMethod(Type baseClass, string method, params Type[] parameters) } else if (!singletonSet.Add(mi)) { - throw new NotSupportedException("VirtualMethod instances must be singletons and therefore " + "assigned to static final members in the same class, they use as baseClass ctor param."); + throw UnsupportedOperationException.Create("VirtualMethod instances must be singletons and therefore " + "assigned to static final members in the same class, they use as baseClass ctor param."); } } catch (Exception nsme) when (nsme.IsNoSuchMethodException())