Repository: lucenenet Updated Branches: refs/heads/api-work 369f738bb -> cd52681c8
SWEEP: Added many missing catch blocks that were converting IOException to RuntimeException (which we are using Exception for). Changed error messages to add the entire original stack trace (via e.ToString()) rather than swallowing it, since it is not preserved when you rethrow an error. Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/c96a083e Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/c96a083e Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/c96a083e Branch: refs/heads/api-work Commit: c96a083edf97730a8fc695e5b9595a5ffa86bc17 Parents: 369f738 Author: Shad Storhaug <[email protected]> Authored: Thu Mar 9 20:14:17 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Thu Mar 9 20:14:17 2017 +0700 ---------------------------------------------------------------------- .../Memory/MemoryDocValuesConsumer.cs | 9 +- .../Memory/MemoryDocValuesProducer.cs | 8 +- .../SimpleText/SimpleTextDocValuesReader.cs | 277 +++++++++++-------- .../Lucene45/Lucene45DocValuesProducer.cs | 28 +- .../Index/BinaryDocValuesWriter.cs | 12 +- src/Lucene.Net.Core/Index/DocTermOrds.cs | 4 +- src/Lucene.Net.Core/Index/MergePolicy.cs | 2 +- src/Lucene.Net.Core/Index/PrefixCodedTerms.cs | 34 ++- src/Lucene.Net.Core/Index/TieredMergePolicy.cs | 2 +- .../Search/ControlledRealTimeReopenThread.cs | 2 +- src/Lucene.Net.Core/Search/IndexSearcher.cs | 12 + src/Lucene.Net.Core/Store/LockVerifyServer.cs | 4 + src/Lucene.Net.Core/Store/NIOFSDirectory.cs | 2 +- .../ExpressionComparator.cs | 15 +- .../ScoreFunctionValues.cs | 2 +- .../Taxonomy/TaxonomyFacetSumValueSource.cs | 4 +- .../Highlight/TokenSources.cs | 2 +- .../PostingsHighlight/PostingsHighlighter.cs | 2 +- .../VectorHighlight/FastVectorHighlighter.cs | 2 +- src/Lucene.Net.Memory/MemoryIndex.cs | 14 +- .../Index/Sorter/BlockJoinComparatorSource.cs | 2 +- src/Lucene.Net.Misc/Index/Sorter/Sorter.cs | 2 +- .../Processors/AnalyzerQueryNodeProcessor.cs | 2 +- .../Serialized/SerializedDVStrategy.cs | 20 +- .../Analyzing/AnalyzingInfixSuggester.cs | 2 +- .../Suggest/Analyzing/AnalyzingSuggester.cs | 4 +- .../Suggest/Analyzing/FreeTextSuggester.cs | 21 +- .../Suggest/DocumentValueSourceDictionary.cs | 4 +- .../Suggest/FileDictionary.cs | 6 +- .../Suggest/Fst/FSTCompletion.cs | 6 +- .../Suggest/Fst/WFSTCompletionLookup.cs | 6 +- .../Lucene42/Lucene42DocValuesConsumer.cs | 2 +- .../Index/BaseDocValuesFormatTestCase.cs | 4 +- .../Search/QueryUtils.cs | 8 +- .../Taxonomy/Directory/TestAddTaxonomy.cs | 4 +- .../Directory/TestConcurrentFacetedIndexing.cs | 2 +- .../Directory/TestDirectoryTaxonomyWriter.cs | 2 +- .../Taxonomy/TestCachedOrdinalsReader.cs | 2 +- .../Taxonomy/TestSearcherTaxonomyManager.cs | 2 +- .../Taxonomy/TestTaxonomyFacetSumValueSource.cs | 2 +- .../Lucene.Net.Tests.Spatial.csproj | 1 - src/Lucene.Net.Tests.Spatial/SpatialTestCase.cs | 2 +- src/Lucene.Net.Tests.Spatial/SpatialTestData.cs | 4 +- .../SpatialTestException.cs | 20 -- .../SpatialTestQuery.cs | 2 +- .../Suggest/Analyzing/TestFreeTextSuggester.cs | 4 +- .../Index/TestBinaryDocValuesUpdates.cs | 4 +- src/Lucene.Net.Tests/Index/TestCodecs.cs | 2 +- .../Index/TestConcurrentMergeScheduler.cs | 2 +- .../Index/TestDocValuesWithThreads.cs | 2 +- src/Lucene.Net.Tests/Index/TestIndexWriter.cs | 6 +- .../Index/TestMixedDocValuesUpdates.cs | 4 +- .../Index/TestNumericDocValuesUpdates.cs | 4 +- .../Search/TestQueryRescorer.cs | 2 +- src/Lucene.Net.Tests/Search/TestSortRescorer.cs | 2 +- src/Lucene.Net.Tests/Store/TestCopyBytes.cs | 2 +- src/Lucene.Net.Tests/Store/TestDirectory.cs | 6 +- src/Lucene.Net.Tests/Store/TestRAMDirectory.cs | 2 +- 58 files changed, 343 insertions(+), 268 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs index 9226eed..7600925 100644 --- a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs +++ b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs @@ -472,7 +472,14 @@ namespace Lucene.Net.Codecs.Memory buffer = ArrayUtil.Grow(buffer, maxSize); } - EncodeValues(count); + try + { + EncodeValues(count); + } + catch (System.IO.IOException bogus) + { + throw new Exception(bogus.ToString(), bogus); + } _current.Bytes = buffer; _current.Offset = 0; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs index d22301d..0744276 100644 --- a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs +++ b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs @@ -492,7 +492,7 @@ namespace Lucene.Net.Codecs.Memory } catch (IOException bogus) { - throw new Exception(bogus.Message, bogus); + throw new Exception(bogus.ToString(), bogus); } } @@ -516,7 +516,7 @@ namespace Lucene.Net.Codecs.Memory } catch (IOException bogus) { - throw new Exception(bogus.Message, bogus); + throw new Exception(bogus.ToString(), bogus); } } @@ -629,7 +629,7 @@ namespace Lucene.Net.Codecs.Memory } catch (IOException bogus) { - throw new Exception(bogus.Message, bogus); + throw new Exception(bogus.ToString(), bogus); } } @@ -653,7 +653,7 @@ namespace Lucene.Net.Codecs.Memory } catch (IOException bogus) { - throw new Exception(bogus.Message, bogus); + throw new Exception(bogus.ToString(), bogus); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs index 09b58f6..39fe395 100644 --- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs +++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs @@ -171,27 +171,34 @@ namespace Lucene.Net.Codecs.SimpleText public override long Get(int docId) { - if (docId < 0 || docId >= _outerInstance.maxDoc) - throw new IndexOutOfRangeException("docID must be 0 .. " + (_outerInstance.maxDoc - 1) + - "; got " + docId); - - _input.Seek(_field.DataStartFilePointer + (1 + _field.Pattern.Length + 2) * docId); - SimpleTextUtil.ReadLine(_input, _scratch); - - - decimal bd; try { - // LUCNENENET: .NET doesn't have a way to specify a pattern with decimal, but all of the standard ones are built in. - bd = decimal.Parse(_scratch.Utf8ToString(), NumberStyles.Float, CultureInfo.InvariantCulture); + if (docId < 0 || docId >= _outerInstance.maxDoc) + throw new IndexOutOfRangeException("docID must be 0 .. " + (_outerInstance.maxDoc - 1) + + "; got " + docId); + + _input.Seek(_field.DataStartFilePointer + (1 + _field.Pattern.Length + 2) * docId); + SimpleTextUtil.ReadLine(_input, _scratch); + + + decimal bd; + try + { + // LUCNENENET: .NET doesn't have a way to specify a pattern with decimal, but all of the standard ones are built in. + bd = decimal.Parse(_scratch.Utf8ToString(), NumberStyles.Float, CultureInfo.InvariantCulture); + } + catch (FormatException ex) + { + throw new CorruptIndexException("failed to parse long value (resource=" + _input + ")", ex); + } + + SimpleTextUtil.ReadLine(_input, _scratch); // read the line telling us if its real or not + return (long)BigInteger.Add(new BigInteger(_field.MinValue), new BigInteger(bd)); } - catch (FormatException ex) + catch (System.IO.IOException ioe) { - throw new CorruptIndexException("failed to parse long value (resource=" + _input + ")", ex); + throw new Exception(ioe.ToString(), ioe); } - - SimpleTextUtil.ReadLine(_input, _scratch); // read the line telling us if its real or not - return (long)BigInteger.Add(new BigInteger(_field.MinValue), new BigInteger(bd)); } } @@ -222,10 +229,17 @@ namespace Lucene.Net.Codecs.SimpleText public bool Get(int index) { - _input.Seek(_field.DataStartFilePointer + (1 + _field.Pattern.Length + 2) * index); - SimpleTextUtil.ReadLine(_input, _scratch); // data - SimpleTextUtil.ReadLine(_input, _scratch); // 'T' or 'F' - return _scratch.Bytes[_scratch.Offset] == (sbyte)'T'; + try + { + _input.Seek(_field.DataStartFilePointer + (1 + _field.Pattern.Length + 2) * index); + SimpleTextUtil.ReadLine(_input, _scratch); // data + SimpleTextUtil.ReadLine(_input, _scratch); // 'T' or 'F' + return _scratch.Bytes[_scratch.Offset] == (byte)'T'; + } + catch (System.IO.IOException e) + { + throw new Exception(e.ToString(), e); + } } public int Length @@ -263,29 +277,36 @@ namespace Lucene.Net.Codecs.SimpleText public override void Get(int docId, BytesRef result) { - if (docId < 0 || docId >= _outerInstance.maxDoc) - throw new IndexOutOfRangeException("docID must be 0 .. " + (_outerInstance.maxDoc - 1) + - "; got " + docId); - - _input.Seek(_field.DataStartFilePointer + (9 + _field.Pattern.Length + _field.MaxLength + 2) * docId); - SimpleTextUtil.ReadLine(_input, _scratch); - Debug.Assert(StringHelper.StartsWith(_scratch, SimpleTextDocValuesWriter.LENGTH)); - int len; try { - // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. - len = int.Parse(Encoding.UTF8.GetString(_scratch.Bytes, _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, - _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length), NumberStyles.Integer, CultureInfo.InvariantCulture); + if (docId < 0 || docId >= _outerInstance.maxDoc) + throw new IndexOutOfRangeException("docID must be 0 .. " + (_outerInstance.maxDoc - 1) + + "; got " + docId); + + _input.Seek(_field.DataStartFilePointer + (9 + _field.Pattern.Length + _field.MaxLength + 2) * docId); + SimpleTextUtil.ReadLine(_input, _scratch); + Debug.Assert(StringHelper.StartsWith(_scratch, SimpleTextDocValuesWriter.LENGTH)); + int len; + try + { + // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. + len = int.Parse(Encoding.UTF8.GetString(_scratch.Bytes, _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, + _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length), NumberStyles.Integer, CultureInfo.InvariantCulture); + } + catch (FormatException ex) + { + throw new CorruptIndexException("failed to parse int value (resource=" + _input + ")", ex); + } + + result.Bytes = new byte[len]; + result.Offset = 0; + result.Length = len; + _input.ReadBytes(result.Bytes, 0, len); } - catch (FormatException ex) + catch (System.IO.IOException ioe) { - throw new CorruptIndexException("failed to parse int value (resource=" + _input + ")", ex); + throw new Exception(ioe.ToString(), ioe); } - - result.Bytes = new byte[len]; - result.Offset = 0; - result.Length = len; - _input.ReadBytes(result.Bytes, 0, len); } } @@ -317,26 +338,33 @@ namespace Lucene.Net.Codecs.SimpleText public bool Get(int index) { - _input.Seek(_field.DataStartFilePointer + (9 + _field.Pattern.Length + _field.MaxLength + 2) * index); - SimpleTextUtil.ReadLine(_input, _scratch); - Debug.Assert(StringHelper.StartsWith(_scratch, SimpleTextDocValuesWriter.LENGTH)); - int len; try { - len = int.Parse(Encoding.UTF8.GetString(_scratch.Bytes, _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, - _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length), NumberStyles.Number, CultureInfo.InvariantCulture); + _input.Seek(_field.DataStartFilePointer + (9 + _field.Pattern.Length + _field.MaxLength + 2) * index); + SimpleTextUtil.ReadLine(_input, _scratch); + Debug.Assert(StringHelper.StartsWith(_scratch, SimpleTextDocValuesWriter.LENGTH)); + int len; + try + { + len = int.Parse(Encoding.UTF8.GetString(_scratch.Bytes, _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, + _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length), NumberStyles.Number, CultureInfo.InvariantCulture); + } + catch (FormatException ex) + { + throw new CorruptIndexException("failed to parse int value (resource=" + _input + ")", ex); + } + + // skip past bytes + var bytes = new byte[len]; + _input.ReadBytes(bytes, 0, len); + SimpleTextUtil.ReadLine(_input, _scratch); // newline + SimpleTextUtil.ReadLine(_input, _scratch); // 'T' or 'F' + return _scratch.Bytes[_scratch.Offset] == (byte)'T'; } - catch (FormatException ex) + catch (System.IO.IOException ioe) { - throw new CorruptIndexException("failed to parse int value (resource=" + _input + ")", ex); + throw new Exception(ioe.ToString(), ioe); } - - // skip past bytes - var bytes = new byte[len]; - _input.ReadBytes(bytes, 0, len); - SimpleTextUtil.ReadLine(_input, _scratch); // newline - SimpleTextUtil.ReadLine(_input, _scratch); // 'T' or 'F' - return _scratch.Bytes[_scratch.Offset] == (sbyte)'T'; } public int Length @@ -386,50 +414,64 @@ namespace Lucene.Net.Codecs.SimpleText docId); } - _input.Seek(_field.DataStartFilePointer + _field.NumValues * (9 + _field.Pattern.Length + _field.MaxLength) + - docId * (1 + _field.OrdPattern.Length)); - SimpleTextUtil.ReadLine(_input, _scratch); try { - // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. - return int.Parse(_scratch.Utf8ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture) - 1; + _input.Seek(_field.DataStartFilePointer + _field.NumValues * (9 + _field.Pattern.Length + _field.MaxLength) + + docId * (1 + _field.OrdPattern.Length)); + SimpleTextUtil.ReadLine(_input, _scratch); + try + { + // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. + return int.Parse(_scratch.Utf8ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture) - 1; + } + catch (Exception pe) + { + var e = new CorruptIndexException("failed to parse ord (resource=" + _input + ")", pe); + throw e; + } } - catch (Exception pe) + catch (System.IO.IOException ioe) { - var e = new CorruptIndexException("failed to parse ord (resource=" + _input + ")", pe); - throw e; + throw new Exception(ioe.ToString(), ioe); } } public override void LookupOrd(int ord, BytesRef result) { - if (ord < 0 || ord >= _field.NumValues) - { - throw new IndexOutOfRangeException("ord must be 0 .. " + (_field.NumValues - 1) + "; got " + - ord); - } - _input.Seek(_field.DataStartFilePointer + ord * (9 + _field.Pattern.Length + _field.MaxLength)); - SimpleTextUtil.ReadLine(_input, _scratch); - Debug.Assert(StringHelper.StartsWith(_scratch, SimpleTextDocValuesWriter.LENGTH), - "got " + _scratch.Utf8ToString() + " in=" + _input); - int len; try { - // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. - len = int.Parse(Encoding.UTF8.GetString(_scratch.Bytes, _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, - _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length), NumberStyles.Integer, CultureInfo.InvariantCulture); - + if (ord < 0 || ord >= _field.NumValues) + { + throw new IndexOutOfRangeException("ord must be 0 .. " + (_field.NumValues - 1) + "; got " + + ord); + } + _input.Seek(_field.DataStartFilePointer + ord * (9 + _field.Pattern.Length + _field.MaxLength)); + SimpleTextUtil.ReadLine(_input, _scratch); + Debug.Assert(StringHelper.StartsWith(_scratch, SimpleTextDocValuesWriter.LENGTH), + "got " + _scratch.Utf8ToString() + " in=" + _input); + int len; + try + { + // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. + len = int.Parse(Encoding.UTF8.GetString(_scratch.Bytes, _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, + _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length), NumberStyles.Integer, CultureInfo.InvariantCulture); + + } + catch (Exception pe) + { + var e = new CorruptIndexException("failed to parse int length (resource=" + _input + ")", pe); + throw e; + } + + result.Bytes = new byte[len]; + result.Offset = 0; + result.Length = len; + _input.ReadBytes(result.Bytes, 0, len); } - catch (Exception pe) + catch (System.IO.IOException ioe) { - var e = new CorruptIndexException("failed to parse int length (resource=" + _input + ")", pe); - throw e; + throw new Exception(ioe.ToString(), ioe); } - - result.Bytes = new byte[len]; - result.Offset = 0; - result.Length = len; - _input.ReadBytes(result.Bytes, 0, len); } public override int ValueCount @@ -487,43 +529,56 @@ namespace Lucene.Net.Codecs.SimpleText throw new IndexOutOfRangeException("docID must be 0 .. " + (_outerInstance.maxDoc - 1) + "; got " + docID); - - _input.Seek(_field.DataStartFilePointer + _field.NumValues * (9 + _field.Pattern.Length + _field.MaxLength) + - docID * (1 + _field.OrdPattern.Length)); - SimpleTextUtil.ReadLine(_input, _scratch); - var ordList = _scratch.Utf8ToString().Trim(); - _currentOrds = ordList.Length == 0 ? new string[0] : ordList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - _currentIndex = 0; + try + { + _input.Seek(_field.DataStartFilePointer + _field.NumValues * (9 + _field.Pattern.Length + _field.MaxLength) + + docID * (1 + _field.OrdPattern.Length)); + SimpleTextUtil.ReadLine(_input, _scratch); + var ordList = _scratch.Utf8ToString().Trim(); + _currentOrds = ordList.Length == 0 ? new string[0] : ordList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + _currentIndex = 0; + } + catch (System.IO.IOException ioe) + { + throw new Exception(ioe.ToString(), ioe); + } } public override void LookupOrd(long ord, BytesRef result) { - if (ord < 0 || ord >= _field.NumValues) - { - throw new IndexOutOfRangeException("ord must be 0 .. " + (_field.NumValues - 1) + "; got " + ord); - } - - _input.Seek(_field.DataStartFilePointer + ord * (9 + _field.Pattern.Length + _field.MaxLength)); - SimpleTextUtil.ReadLine(_input, _scratch); - Debug.Assert(StringHelper.StartsWith(_scratch, SimpleTextDocValuesWriter.LENGTH), - "got " + _scratch.Utf8ToString() + " in=" + _input); - int len; try { - // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. - len = int.Parse(Encoding.UTF8.GetString(_scratch.Bytes, _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, - _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length), NumberStyles.Integer, CultureInfo.InvariantCulture); + if (ord < 0 || ord >= _field.NumValues) + { + throw new IndexOutOfRangeException("ord must be 0 .. " + (_field.NumValues - 1) + "; got " + ord); + } + + _input.Seek(_field.DataStartFilePointer + ord * (9 + _field.Pattern.Length + _field.MaxLength)); + SimpleTextUtil.ReadLine(_input, _scratch); + Debug.Assert(StringHelper.StartsWith(_scratch, SimpleTextDocValuesWriter.LENGTH), + "got " + _scratch.Utf8ToString() + " in=" + _input); + int len; + try + { + // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. + len = int.Parse(Encoding.UTF8.GetString(_scratch.Bytes, _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, + _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length), NumberStyles.Integer, CultureInfo.InvariantCulture); + } + catch (Exception pe) + { + var e = new CorruptIndexException("failed to parse int length (resource=" + _input + ")", pe); + throw e; + } + + result.Bytes = new byte[len]; + result.Offset = 0; + result.Length = len; + _input.ReadBytes(result.Bytes, 0, len); } - catch (Exception pe) + catch (System.IO.IOException ioe) { - var e = new CorruptIndexException("failed to parse int length (resource=" + _input + ")", pe); - throw e; + throw new Exception(ioe.ToString(), ioe); } - - result.Bytes = new byte[len]; - result.Offset = 0; - result.Length = len; - _input.ReadBytes(result.Bytes, 0, len); } public override long ValueCount http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesProducer.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesProducer.cs b/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesProducer.cs index c627861..871517d 100644 --- a/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesProducer.cs +++ b/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesProducer.cs @@ -494,9 +494,9 @@ namespace Lucene.Net.Codecs.Lucene45 result.Offset = 0; result.Length = buffer.Length; } - catch (Exception) + catch (System.IO.IOException e) { - throw; + throw new Exception(e.ToString(), e); } } } @@ -564,9 +564,9 @@ namespace Lucene.Net.Codecs.Lucene45 result.Offset = 0; result.Length = length; } - catch (Exception) + catch (System.IO.IOException e) { - throw; + throw new Exception(e.ToString(), e); } } } @@ -853,11 +853,9 @@ namespace Lucene.Net.Codecs.Lucene45 @in.Seek(offset + (index >> 3)); return (@in.ReadByte() & (1 << (index & 7))) != 0; } -#pragma warning disable 168 - catch (Exception e) -#pragma warning restore 168 + catch (System.IO.IOException e) { - throw; + throw new Exception(e.ToString(), e); } } @@ -1037,11 +1035,9 @@ namespace Lucene.Net.Codecs.Lucene45 result.Offset = term.Offset; result.Length = term.Length; } -#pragma warning disable 168 - catch (Exception e) -#pragma warning restore 168 + catch (System.IO.IOException e) { - throw; + throw new Exception(e.ToString(), e); } } @@ -1063,9 +1059,9 @@ namespace Lucene.Net.Codecs.Lucene45 return -termsEnum.Ord - 1; } } - catch (Exception) + catch (System.IO.IOException bogus) { - throw; + throw new Exception(bogus.ToString(), bogus); } } @@ -1075,9 +1071,9 @@ namespace Lucene.Net.Codecs.Lucene45 { return GetTermsEnum((IndexInput)data.Clone()); } - catch (Exception) + catch (System.IO.IOException e) { - throw; + throw new Exception(e.ToString(), e); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs b/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs index 908c2af..5c6be34 100644 --- a/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs +++ b/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs @@ -97,7 +97,7 @@ namespace Lucene.Net.Index catch (System.IO.IOException ioe) { // Should never happen! - throw new Exception(ioe.Message, ioe); + throw new Exception(ioe.ToString(), ioe); } docsWithField = FixedBitSet.EnsureCapacity(docsWithField, docID); docsWithField.Set(docID); @@ -151,7 +151,15 @@ namespace Lucene.Net.Index var value = new BytesRef(); value.Grow(length); value.Length = length; - bytesIterator.ReadBytes(value.Bytes, value.Offset, value.Length); + try + { + bytesIterator.ReadBytes(value.Bytes, value.Offset, value.Length); + } + catch (System.IO.IOException ioe) + { + // Should never happen! + throw new Exception(ioe.ToString(), ioe); + } if (docsWithField.Get(upto)) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Core/Index/DocTermOrds.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/DocTermOrds.cs b/src/Lucene.Net.Core/Index/DocTermOrds.cs index 0be0147..e3f3a72 100644 --- a/src/Lucene.Net.Core/Index/DocTermOrds.cs +++ b/src/Lucene.Net.Core/Index/DocTermOrds.cs @@ -1085,7 +1085,7 @@ namespace Lucene.Net.Index } catch (System.IO.IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } result.Bytes = @ref.Bytes; result.Offset = @ref.Offset; @@ -1115,7 +1115,7 @@ namespace Lucene.Net.Index } catch (System.IO.IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Core/Index/MergePolicy.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/MergePolicy.cs b/src/Lucene.Net.Core/Index/MergePolicy.cs index b886e27..4750e49 100644 --- a/src/Lucene.Net.Core/Index/MergePolicy.cs +++ b/src/Lucene.Net.Core/Index/MergePolicy.cs @@ -304,7 +304,7 @@ namespace Lucene.Net.Index } catch (ThreadInterruptedException ie) { - throw new Exception(ie.Message, ie); + throw new Exception(ie.ToString(), ie); } #endif if (aborted) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Core/Index/PrefixCodedTerms.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/PrefixCodedTerms.cs b/src/Lucene.Net.Core/Index/PrefixCodedTerms.cs index f965cc2..b2be2a6 100644 --- a/src/Lucene.Net.Core/Index/PrefixCodedTerms.cs +++ b/src/Lucene.Net.Core/Index/PrefixCodedTerms.cs @@ -78,9 +78,9 @@ namespace Lucene.Net.Index { input = new RAMInputStream("PrefixCodedTermsIterator", buffer); } - catch (System.IO.IOException) + catch (System.IO.IOException e) { - throw; + throw new Exception(e.ToString(), e); } } @@ -102,17 +102,25 @@ namespace Lucene.Net.Index { if (input.FilePointer < input.Length) { - int code = input.ReadVInt32(); - if ((code & 1) != 0) + try { - field = input.ReadString(); + int code = input.ReadVInt32(); + if ((code & 1) != 0) + { + field = input.ReadString(); + } + int prefix = Number.URShift(code, 1); + int suffix = input.ReadVInt32(); + bytes.Grow(prefix + suffix); + input.ReadBytes(bytes.Bytes, prefix, suffix); + bytes.Length = prefix + suffix; + term.Set(field, bytes); } - int prefix = Number.URShift(code, 1); - int suffix = input.ReadVInt32(); - bytes.Grow(prefix + suffix); - input.ReadBytes(bytes.Bytes, prefix, suffix); - bytes.Length = prefix + suffix; - term.Set(field, bytes); + catch (IOException e) + { + throw new Exception(e.ToString(), e); + } + return true; } return false; @@ -168,7 +176,7 @@ namespace Lucene.Net.Index } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } @@ -183,7 +191,7 @@ namespace Lucene.Net.Index } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Core/Index/TieredMergePolicy.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/TieredMergePolicy.cs b/src/Lucene.Net.Core/Index/TieredMergePolicy.cs index 028cbc7..419ee4b 100644 --- a/src/Lucene.Net.Core/Index/TieredMergePolicy.cs +++ b/src/Lucene.Net.Core/Index/TieredMergePolicy.cs @@ -364,7 +364,7 @@ namespace Lucene.Net.Index } catch (System.IO.IOException ioe) { - throw new Exception(ioe.Message, ioe); + throw new Exception(ioe.ToString(), ioe); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Core/Search/ControlledRealTimeReopenThread.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/ControlledRealTimeReopenThread.cs b/src/Lucene.Net.Core/Search/ControlledRealTimeReopenThread.cs index 56c83c8..898c0a4 100644 --- a/src/Lucene.Net.Core/Search/ControlledRealTimeReopenThread.cs +++ b/src/Lucene.Net.Core/Search/ControlledRealTimeReopenThread.cs @@ -310,7 +310,7 @@ namespace Lucene.Net.Search } catch (System.IO.IOException ioe) { - throw new Exception(ioe.Message, ioe); + throw new Exception(ioe.ToString(), ioe); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Core/Search/IndexSearcher.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/IndexSearcher.cs b/src/Lucene.Net.Core/Search/IndexSearcher.cs index 4d6eff1..814657c 100644 --- a/src/Lucene.Net.Core/Search/IndexSearcher.cs +++ b/src/Lucene.Net.Core/Search/IndexSearcher.cs @@ -940,6 +940,18 @@ namespace Lucene.Net.Search { current = service.Take().Result; } +#if !NETSTANDARD + catch (System.Threading.ThreadInterruptedException) + { + throw; + } +#endif + catch (Exception e) + { + // LUCENENET NOTE: We need to re-throw this as Exception to + // ensure it is not caught in the wrong place + throw new Exception(e.ToString(), e); + } finally { --numTasks; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Core/Store/LockVerifyServer.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Store/LockVerifyServer.cs b/src/Lucene.Net.Core/Store/LockVerifyServer.cs index 1109e88..19f0579 100644 --- a/src/Lucene.Net.Core/Store/LockVerifyServer.cs +++ b/src/Lucene.Net.Core/Store/LockVerifyServer.cs @@ -178,6 +178,10 @@ namespace Lucene.Net.Store } } } + catch (IOException ioe) + { + throw new Exception(ioe.ToString(), ioe); + } catch (Exception e) { throw e; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Core/Store/NIOFSDirectory.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Store/NIOFSDirectory.cs b/src/Lucene.Net.Core/Store/NIOFSDirectory.cs index ba033fd..1b540b5 100644 --- a/src/Lucene.Net.Core/Store/NIOFSDirectory.cs +++ b/src/Lucene.Net.Core/Store/NIOFSDirectory.cs @@ -125,7 +125,7 @@ namespace Lucene.Net.Store } catch (IOException ex) { - throw new Exception(ex.Message, ex); + throw new Exception(ex.ToString(), ex); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Expressions/ExpressionComparator.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Expressions/ExpressionComparator.cs b/src/Lucene.Net.Expressions/ExpressionComparator.cs index 56f98ab..47ed043 100644 --- a/src/Lucene.Net.Expressions/ExpressionComparator.cs +++ b/src/Lucene.Net.Expressions/ExpressionComparator.cs @@ -48,10 +48,17 @@ namespace Lucene.Net.Expressions // TODO: might be cleaner to lazy-init 'source' and set scorer after? Debug.Assert(readerContext != null); - var context = new Dictionary<string, object>(); - Debug.Assert(scorer != null); - context["scorer"] = scorer; - scores = source.GetValues(context, readerContext); + try + { + var context = new Dictionary<string, object>(); + Debug.Assert(scorer != null); + context["scorer"] = scorer; + scores = source.GetValues(context, readerContext); + } + catch (System.IO.IOException e) + { + throw new Exception(e.ToString(), e); + } } public override int Compare(int slot1, int slot2) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Expressions/ScoreFunctionValues.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs index d87c16f..8f66680 100644 --- a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs +++ b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs @@ -47,7 +47,7 @@ namespace Lucene.Net.Expressions } catch (IOException exception) { - throw new Exception(exception.Message, exception); + throw new Exception(exception.ToString(), exception); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs index 2004ad2..438931d 100644 --- a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs +++ b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs @@ -198,9 +198,9 @@ namespace Lucene.Net.Facet.Taxonomy { return scorer.GetScore(); } - catch (Exception /*exception*/) + catch (System.IO.IOException exception) { - throw; + throw new Exception(exception.ToString(), exception); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs b/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs index 7efbcf7..05f8e92 100644 --- a/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs +++ b/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs @@ -344,7 +344,7 @@ namespace Lucene.Net.Search.Highlight } catch (IOException ex) { - throw new Exception(ex.Message, ex); + throw new Exception(ex.ToString(), ex); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs index ce611be..b2f7097 100644 --- a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs +++ b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs @@ -815,7 +815,7 @@ namespace Lucene.Net.Search.PostingsHighlight } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Highlighter/VectorHighlight/FastVectorHighlighter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/FastVectorHighlighter.cs b/src/Lucene.Net.Highlighter/VectorHighlight/FastVectorHighlighter.cs index bca368e..4a37bd8 100644 --- a/src/Lucene.Net.Highlighter/VectorHighlight/FastVectorHighlighter.cs +++ b/src/Lucene.Net.Highlighter/VectorHighlight/FastVectorHighlighter.cs @@ -87,7 +87,7 @@ namespace Lucene.Net.Search.VectorHighlight catch (IOException e) { // should never be thrown when reader is null - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Memory/MemoryIndex.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Memory/MemoryIndex.cs b/src/Lucene.Net.Memory/MemoryIndex.cs index a211c45..3dbf24c 100644 --- a/src/Lucene.Net.Memory/MemoryIndex.cs +++ b/src/Lucene.Net.Memory/MemoryIndex.cs @@ -253,7 +253,7 @@ namespace Lucene.Net.Index.Memory } catch (IOException ex) { - throw new Exception(ex.Message, ex); + throw new Exception(ex.ToString(), ex); } AddField(fieldName, stream, 1.0f, analyzer.GetPositionIncrementGap(fieldName), analyzer.GetOffsetGap(fieldName)); @@ -477,9 +477,9 @@ namespace Lucene.Net.Index.Memory sortedFields = null; // invalidate sorted view, if any } } // can never happen - catch (Exception /*e*/) + catch (Exception e) { - throw; + throw new Exception(e.ToString(), e); } finally { @@ -490,9 +490,9 @@ namespace Lucene.Net.Index.Memory stream.Dispose(); } } - catch (IOException /*e2*/) + catch (IOException e2) { - throw; + throw new Exception(e2.ToString(), e2); } } } @@ -534,9 +534,9 @@ namespace Lucene.Net.Index.Memory float score = scores[0]; return score; } // can never happen (RAMDirectory) - catch (IOException /*e*/) + catch (IOException e) { - throw; + throw new Exception(e.ToString(), e); } finally { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Misc/Index/Sorter/BlockJoinComparatorSource.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Misc/Index/Sorter/BlockJoinComparatorSource.cs b/src/Lucene.Net.Misc/Index/Sorter/BlockJoinComparatorSource.cs index d2f0fbc..bf01511 100644 --- a/src/Lucene.Net.Misc/Index/Sorter/BlockJoinComparatorSource.cs +++ b/src/Lucene.Net.Misc/Index/Sorter/BlockJoinComparatorSource.cs @@ -135,7 +135,7 @@ namespace Lucene.Net.Index.Sorter } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs b/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs index 8b48091..841bead 100644 --- a/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs +++ b/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs @@ -307,7 +307,7 @@ namespace Lucene.Net.Index.Sorter } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs index 559a3a5..7927210 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs @@ -151,7 +151,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } finally { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs b/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs index 8bbc895..0f68c8d 100644 --- a/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs +++ b/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs @@ -72,7 +72,7 @@ namespace Lucene.Net.Spatial.Serialized } catch (IOException e) { - throw new SerializedDVStrategyException(e.Message, e); + throw new Exception(e.ToString(), e); } this.indexLastBufSize = bytesRef.Length;//cache heuristic return new Field[] { new BinaryDocValuesField(FieldName, bytesRef) }; @@ -308,7 +308,7 @@ namespace Lucene.Net.Spatial.Serialized } catch (IOException e) { - throw new SerializedDVStrategyException(e.Message, e); + throw new Exception(e.ToString(), e); } } @@ -348,20 +348,4 @@ namespace Lucene.Net.Spatial.Serialized }//ShapeDocValueSource } - - /// <summary> - /// LUCENENET: Exception thrown when an operation fails in - /// SerializedDVStrategy. Replaces generic ApplicationException that is - /// not supported on .NET Core. - /// </summary> - public class SerializedDVStrategyException : Exception - { - public SerializedDVStrategyException(string message) - : base(message) - { } - - public SerializedDVStrategyException(string message, Exception innerException) - : base(message, innerException) - { } - } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs index 28d7220..8a32e62 100644 --- a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs +++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs @@ -778,7 +778,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing } catch (IOException ioe) { - throw new Exception(ioe.Message, ioe); + throw new Exception(ioe.ToString(), ioe); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs index 33c741b..751fb08 100644 --- a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs +++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs @@ -865,9 +865,9 @@ namespace Lucene.Net.Search.Suggest.Analyzing return results; } - catch (IOException /*bogus*/) + catch (IOException bogus) { - throw; + throw new Exception(bogus.ToString(), bogus); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs index a67fe77..ead705a 100644 --- a/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs +++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs @@ -497,7 +497,15 @@ namespace Lucene.Net.Search.Suggest.Analyzing public override IList<LookupResult> DoLookup(string key, IEnumerable<BytesRef> contexts, /* ignored */ bool onlyMorePopular, int num) { - return DoLookup(key, contexts, num); + try + { + return DoLookup(key, contexts, num); + } + catch (IOException ioe) + { + // bogus: + throw new Exception(ioe.ToString(), ioe); + } } public override long Count @@ -651,7 +659,14 @@ namespace Lucene.Net.Search.Suggest.Analyzing // match the prefix portion exactly //Pair<Long,BytesRef> prefixOutput = null; long? prefixOutput = null; - prefixOutput = LookupPrefix(fst, bytesReader, token, arc); + try + { + prefixOutput = LookupPrefix(fst, bytesReader, token, arc); + } + catch (IOException bogus) + { + throw new Exception(bogus.ToString(), bogus); + } //System.out.println(" prefixOutput=" + prefixOutput); if (prefixOutput == null) @@ -725,7 +740,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing } catch (IOException bogus) { - throw new Exception(bogus.Message, bogus); + throw new Exception(bogus.ToString(), bogus); } int prefixLength = token.Length; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Suggest/Suggest/DocumentValueSourceDictionary.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Suggest/Suggest/DocumentValueSourceDictionary.cs b/src/Lucene.Net.Suggest/Suggest/DocumentValueSourceDictionary.cs index 987ab46..703ed69 100644 --- a/src/Lucene.Net.Suggest/Suggest/DocumentValueSourceDictionary.cs +++ b/src/Lucene.Net.Suggest/Suggest/DocumentValueSourceDictionary.cs @@ -153,9 +153,9 @@ namespace Lucene.Net.Search.Suggest { currentWeightValues = outerInstance.weightsValueSource.GetValues(new Dictionary<string, object>(), leaves[currentLeafIndex]); } - catch (IOException) + catch (IOException e) { - throw new Exception(); + throw new Exception(e.ToString(), e); } } return currentWeightValues.Int64Val(docId - starts[subIndex]); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs b/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs index 750c35b..0dac6bd 100644 --- a/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs +++ b/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs @@ -111,7 +111,7 @@ namespace Lucene.Net.Search.Suggest this.fieldDelimiter = fieldDelimiter; } - public virtual IInputIterator EntryIterator + public virtual IInputIterator EntryIterator // LUCENENET TODO: Change to GetEntryIterator() { get { @@ -119,9 +119,9 @@ namespace Lucene.Net.Search.Suggest { return new FileIterator(this); } - catch (IOException) + catch (IOException e) { - throw new Exception(); + throw new Exception(e.ToString(), e); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletion.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletion.cs b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletion.cs index 5c5edd6..d90be7c 100644 --- a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletion.cs +++ b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletion.cs @@ -165,7 +165,7 @@ namespace Lucene.Net.Search.Suggest.Fst } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } @@ -209,7 +209,7 @@ namespace Lucene.Net.Search.Suggest.Fst catch (IOException e) { // Should never happen, but anyway. - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } // No match. @@ -252,7 +252,7 @@ namespace Lucene.Net.Search.Suggest.Fst catch (IOException e) { // Should never happen, but anyway. - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs b/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs index 5b56f6c..a719954 100644 --- a/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs +++ b/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs @@ -162,7 +162,7 @@ namespace Lucene.Net.Search.Suggest.Fst } catch (IOException bogus) { - throw new Exception(bogus.Message, bogus); + throw new Exception(bogus.ToString(), bogus); } if (prefixOutput == null) @@ -192,7 +192,7 @@ namespace Lucene.Net.Search.Suggest.Fst } catch (IOException bogus) { - throw new Exception(bogus.Message, bogus); + throw new Exception(bogus.ToString(), bogus); } BytesRef suffix = new BytesRef(8); @@ -253,7 +253,7 @@ namespace Lucene.Net.Search.Suggest.Fst } catch (IOException bogus) { - throw new Exception(bogus.Message, bogus); + throw new Exception(bogus.ToString(), bogus); } if (result == null || !arc.IsFinal) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42DocValuesConsumer.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42DocValuesConsumer.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42DocValuesConsumer.cs index 8379e72..b76d113 100644 --- a/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42DocValuesConsumer.cs +++ b/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42DocValuesConsumer.cs @@ -420,7 +420,7 @@ namespace Lucene.Net.Codecs.Lucene42 } catch (IOException bogus) { - throw new Exception(bogus.Message, bogus); + throw new Exception(bogus.ToString(), bogus); } @ref.Bytes = Buffer; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs index ff00927..2ef5283 100644 --- a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs +++ b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs @@ -3268,7 +3268,7 @@ namespace Lucene.Net.Index } catch (Exception e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } @@ -3460,7 +3460,7 @@ namespace Lucene.Net.Index } catch (Exception e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.TestFramework/Search/QueryUtils.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Search/QueryUtils.cs b/src/Lucene.Net.TestFramework/Search/QueryUtils.cs index 52212dc..e3ec43b 100644 --- a/src/Lucene.Net.TestFramework/Search/QueryUtils.cs +++ b/src/Lucene.Net.TestFramework/Search/QueryUtils.cs @@ -159,7 +159,7 @@ namespace Lucene.Net.Search } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } @@ -239,7 +239,7 @@ namespace Lucene.Net.Search } catch (IOException ex) { - throw new Exception(ex.Message, ex); + throw new Exception(ex.ToString(), ex); } } @@ -386,7 +386,7 @@ namespace Lucene.Net.Search } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } @@ -510,7 +510,7 @@ namespace Lucene.Net.Search } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestAddTaxonomy.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestAddTaxonomy.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestAddTaxonomy.cs index 2be7da3..1eb67ab 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestAddTaxonomy.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestAddTaxonomy.cs @@ -101,7 +101,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } @@ -312,7 +312,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory catch (IOException e) { // shouldn't happen - if it does, let the test fail on uncaught exception. - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs index 1120661..0d08610 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs @@ -217,7 +217,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs index cb4e68e..dd48ea9 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs @@ -385,7 +385,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests.Facet/Taxonomy/TestCachedOrdinalsReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestCachedOrdinalsReader.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestCachedOrdinalsReader.cs index d528276..66efa99 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestCachedOrdinalsReader.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestCachedOrdinalsReader.cs @@ -106,7 +106,7 @@ namespace Lucene.Net.Facet.Taxonomy } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs index 9e5e7b6..ddd08b2 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs @@ -109,7 +109,7 @@ namespace Lucene.Net.Facet.Taxonomy } catch (IOException ioe) { - throw new Exception(ioe.Message, ioe); + throw new Exception(ioe.ToString(), ioe); } if (VERBOSE) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs index 0ca9461..950ef32 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs @@ -401,7 +401,7 @@ namespace Lucene.Net.Facet.Taxonomy } catch (IOException exception) { - throw new Exception(exception.Message, exception); + throw new Exception(exception.ToString(), exception); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests.Spatial/Lucene.Net.Tests.Spatial.csproj ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Spatial/Lucene.Net.Tests.Spatial.csproj b/src/Lucene.Net.Tests.Spatial/Lucene.Net.Tests.Spatial.csproj index 9e13d0a..0f5ce52 100644 --- a/src/Lucene.Net.Tests.Spatial/Lucene.Net.Tests.Spatial.csproj +++ b/src/Lucene.Net.Tests.Spatial/Lucene.Net.Tests.Spatial.csproj @@ -56,7 +56,6 @@ <Compile Include="SpatialMatchConcern.cs" /> <Compile Include="SpatialTestCase.cs" /> <Compile Include="SpatialTestData.cs" /> - <Compile Include="SpatialTestException.cs" /> <Compile Include="SpatialTestQuery.cs" /> <Compile Include="StrategyTestCase.cs" /> <Compile Include="TestApiConsistency.cs" /> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests.Spatial/SpatialTestCase.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Spatial/SpatialTestCase.cs b/src/Lucene.Net.Tests.Spatial/SpatialTestCase.cs index f400de2..d4b389d 100644 --- a/src/Lucene.Net.Tests.Spatial/SpatialTestCase.cs +++ b/src/Lucene.Net.Tests.Spatial/SpatialTestCase.cs @@ -123,7 +123,7 @@ namespace Lucene.Net.Spatial } catch (IOException ioe) { - throw new SpatialTestException("IOException thrown while executing query", ioe); + throw new Exception("IOException thrown while executing query", ioe); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests.Spatial/SpatialTestData.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Spatial/SpatialTestData.cs b/src/Lucene.Net.Tests.Spatial/SpatialTestData.cs index a95876c..d2be777 100644 --- a/src/Lucene.Net.Tests.Spatial/SpatialTestData.cs +++ b/src/Lucene.Net.Tests.Spatial/SpatialTestData.cs @@ -54,7 +54,7 @@ namespace Lucene.Net.Spatial SpatialTestData data = new SpatialTestData(); String[] vals = line.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); if (vals.Length != 3) - throw new ArgumentException("bad format; expecting 3 tab-separated values for line: " + line); + throw new Exception("bad format; expecting 3 tab-separated values for line: " + line); data.id = vals[0]; data.name = vals[1]; try @@ -63,7 +63,7 @@ namespace Lucene.Net.Spatial } catch (ParseException e) { - throw new SpatialTestException(e.Message, e); + throw new Exception(e.ToString(), e); } results.Add(data); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests.Spatial/SpatialTestException.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Spatial/SpatialTestException.cs b/src/Lucene.Net.Tests.Spatial/SpatialTestException.cs deleted file mode 100644 index 3f53a0d..0000000 --- a/src/Lucene.Net.Tests.Spatial/SpatialTestException.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace Lucene.Net.Spatial -{ - /// <summary> - /// LUCENENET: Exception thrown when an operation fails in a SpatialTest. - /// Replaces generic ApplicationException that is not supported on .NET - /// Core. - /// </summary> - public class SpatialTestException : Exception - { - public SpatialTestException(string message) - : base(message) - { } - - public SpatialTestException(string message, Exception innerException) - : base(message, innerException) - { } - } -} http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests.Spatial/SpatialTestQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Spatial/SpatialTestQuery.cs b/src/Lucene.Net.Tests.Spatial/SpatialTestQuery.cs index 30029e9..282f540 100644 --- a/src/Lucene.Net.Tests.Spatial/SpatialTestQuery.cs +++ b/src/Lucene.Net.Tests.Spatial/SpatialTestQuery.cs @@ -81,7 +81,7 @@ namespace Lucene.Net.Spatial } catch (Exception ex) { - throw new SpatialTestException("invalid query line: " + test.line, ex); + throw new Exception("invalid query line: " + test.line, ex); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs index 23da8d4..53d90c7 100644 --- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs +++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs @@ -164,7 +164,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing } catch (IOException ioe) { - throw new Exception(ioe.Message, ioe); + throw new Exception(ioe.ToString(), ioe); } if (doc == null) { @@ -210,7 +210,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing } } - [Ignore("Ignored test.")] + [Ignore("Ignored in Lucene")] public void TestWiki() { LineFileDocs lfd = new LineFileDocs(null, "/lucenedata/enwiki/enwiki-20120502-lines-1k.txt", false); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs b/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs index 06bcdbd..7b93960 100644 --- a/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs +++ b/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs @@ -1374,7 +1374,7 @@ namespace Lucene.Net.Index } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } finally { @@ -1388,7 +1388,7 @@ namespace Lucene.Net.Index { if (success) // suppress this exception only if there was another exception { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests/Index/TestCodecs.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Index/TestCodecs.cs b/src/Lucene.Net.Tests/Index/TestCodecs.cs index 9fabb90..5f706f7 100644 --- a/src/Lucene.Net.Tests/Index/TestCodecs.cs +++ b/src/Lucene.Net.Tests/Index/TestCodecs.cs @@ -581,7 +581,7 @@ namespace Lucene.Net.Index catch (Exception t) { Failed = true; - throw new Exception(t.Message, t); + throw new Exception(t.toString(), t); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs b/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs index da0395e..93eab70 100644 --- a/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs +++ b/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs @@ -377,7 +377,7 @@ namespace Lucene.Net.Index { Failed.Set(true); m_writer.MergeFinish(merge); - throw new Exception(t.Message, t); + throw new Exception(t.ToString(), t); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs b/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs index b7c7f70..d7c971f 100644 --- a/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs +++ b/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs @@ -290,7 +290,7 @@ namespace Lucene.Net.Index } catch (IOException ioe) { - throw new Exception(ioe.Message, ioe); + throw new Exception(ioe.ToString(), ioe); } while (Environment.TickCount < END_TIME) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests/Index/TestIndexWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs index 88ab444..434c311 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs @@ -1351,7 +1351,7 @@ namespace Lucene.Net.Index } catch (IOException ioe) { - throw new Exception(ioe.Message, ioe); + throw new Exception(ioe.ToString(), ioe); } } @@ -1384,7 +1384,7 @@ namespace Lucene.Net.Index } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } try { @@ -1392,7 +1392,7 @@ namespace Lucene.Net.Index } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests/Index/TestMixedDocValuesUpdates.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Index/TestMixedDocValuesUpdates.cs b/src/Lucene.Net.Tests/Index/TestMixedDocValuesUpdates.cs index 4a3741d..e440ac3 100644 --- a/src/Lucene.Net.Tests/Index/TestMixedDocValuesUpdates.cs +++ b/src/Lucene.Net.Tests/Index/TestMixedDocValuesUpdates.cs @@ -422,7 +422,7 @@ namespace Lucene.Net.Index } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } finally { @@ -436,7 +436,7 @@ namespace Lucene.Net.Index { if (success) // suppress this exception only if there was another exception { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests/Index/TestNumericDocValuesUpdates.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Index/TestNumericDocValuesUpdates.cs b/src/Lucene.Net.Tests/Index/TestNumericDocValuesUpdates.cs index eb02fac..0efaea0 100644 --- a/src/Lucene.Net.Tests/Index/TestNumericDocValuesUpdates.cs +++ b/src/Lucene.Net.Tests/Index/TestNumericDocValuesUpdates.cs @@ -1297,7 +1297,7 @@ namespace Lucene.Net.Index } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } finally { @@ -1311,7 +1311,7 @@ namespace Lucene.Net.Index { if (success) // suppress this exception only if there was another exception { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests/Search/TestQueryRescorer.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Search/TestQueryRescorer.cs b/src/Lucene.Net.Tests/Search/TestQueryRescorer.cs index aa585fc..d0b8375 100644 --- a/src/Lucene.Net.Tests/Search/TestQueryRescorer.cs +++ b/src/Lucene.Net.Tests/Search/TestQueryRescorer.cs @@ -447,7 +447,7 @@ namespace Lucene.Net.Search } catch (IOException ioe) { - throw new Exception(ioe.Message, ioe); + throw new Exception(ioe.ToString(), ioe); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests/Search/TestSortRescorer.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Search/TestSortRescorer.cs b/src/Lucene.Net.Tests/Search/TestSortRescorer.cs index 2ebc16c..038122b 100644 --- a/src/Lucene.Net.Tests/Search/TestSortRescorer.cs +++ b/src/Lucene.Net.Tests/Search/TestSortRescorer.cs @@ -212,7 +212,7 @@ namespace Lucene.Net.Search } catch (IOException ioe) { - throw new Exception(ioe.Message, ioe); + throw new Exception(ioe.ToString(), ioe); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests/Store/TestCopyBytes.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Store/TestCopyBytes.cs b/src/Lucene.Net.Tests/Store/TestCopyBytes.cs index 28023de..50b89ff 100644 --- a/src/Lucene.Net.Tests/Store/TestCopyBytes.cs +++ b/src/Lucene.Net.Tests/Store/TestCopyBytes.cs @@ -192,7 +192,7 @@ namespace Lucene.Net.Store } catch (IOException ex) { - throw new Exception(ex.Message, ex); + throw new Exception(ex.ToString(), ex); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests/Store/TestDirectory.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Store/TestDirectory.cs b/src/Lucene.Net.Tests/Store/TestDirectory.cs index c740945..65f0a3f 100644 --- a/src/Lucene.Net.Tests/Store/TestDirectory.cs +++ b/src/Lucene.Net.Tests/Store/TestDirectory.cs @@ -111,7 +111,7 @@ namespace Lucene.Net.Store } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } @@ -150,7 +150,7 @@ namespace Lucene.Net.Store { if (!e.Message.Contains("still open for writing")) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } if (Random().NextBoolean()) @@ -161,7 +161,7 @@ namespace Lucene.Net.Store } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c96a083e/src/Lucene.Net.Tests/Store/TestRAMDirectory.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Store/TestRAMDirectory.cs b/src/Lucene.Net.Tests/Store/TestRAMDirectory.cs index 37d4005..3126ac8 100644 --- a/src/Lucene.Net.Tests/Store/TestRAMDirectory.cs +++ b/src/Lucene.Net.Tests/Store/TestRAMDirectory.cs @@ -166,7 +166,7 @@ namespace Lucene.Net.Store } catch (IOException e) { - throw new Exception(e.Message, e); + throw new Exception(e.ToString(), e); } } }
