diff --git a/Directory.Build.targets b/Directory.Build.targets
index 1dc7daa031..d08b29eb3e 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -64,7 +64,6 @@
- $(DefineConstants);FEATURE_ARGITERATOR$(DefineConstants);FEATURE_PROCESS_KILL_ENTIREPROCESSTREE$(DefineConstants);FEATURE_STRING_CONCAT_READONLYSPAN
@@ -80,7 +79,7 @@
portable
-
+
$(DefineConstants);FEATURE_ARRAY_FILL
@@ -93,6 +92,13 @@
+
+
+
+ $(DefineConstants);FEATURE_STRING_CONTAINS_STRINGCOMPARISON
+
+
+
@@ -137,7 +143,6 @@
$(DefineConstants);NETFRAMEWORK
- $(DefineConstants);FEATURE_ARGITERATOR$(DefineConstants);FEATURE_CODE_ACCESS_SECURITY
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianAnalyzer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianAnalyzer.cs
index 83c341e541..5cfc5b420d 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianAnalyzer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianAnalyzer.cs
@@ -28,13 +28,13 @@ namespace Lucene.Net.Analysis.Br
*/
///
- /// for Brazilian Portuguese language.
+ /// for Brazilian Portuguese language.
///
/// Supports an external list of stopwords (words that
/// will not be indexed at all) and an external list of exclusions (words that will
/// not be stemmed, but indexed).
///
- ///
+ ///
/// NOTE: This class uses the same
/// dependent settings as .
///
@@ -77,7 +77,7 @@ private static CharArraySet LoadDefaultStopSet() // LUCENENET: Avoid static cons
///
/// Contains words that should be indexed but not stemmed.
///
- private CharArraySet excltable = CharArraySet.Empty;
+ private readonly CharArraySet excltable = CharArraySet.Empty; // LUCENENET: marked readonly
///
/// Builds an analyzer with the default stop words ().
@@ -135,4 +135,4 @@ protected internal override TokenStreamComponents CreateComponents(string fieldN
return new TokenStreamComponents(source, new BrazilianStemFilter(result));
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/HTMLStripCharFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/HTMLStripCharFilter.cs
index d18149ee2e..899c79588d 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/HTMLStripCharFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/HTMLStripCharFilter.cs
@@ -30792,19 +30792,19 @@ CharArrayDictionary result
private static readonly char STYLE_REPLACEMENT = '\n';
private static readonly char REPLACEMENT_CHARACTER = '\uFFFD';
- private CharArraySet escapedTags = null;
+ private readonly CharArraySet escapedTags = null; // LUCENENET: marked readonly
private int inputStart;
private int cumulativeDiff;
- private bool escapeBR = false;
- private bool escapeSCRIPT = false;
- private bool escapeSTYLE = false;
+ private readonly bool escapeBR = false; // LUCENENET: marked readonly
+ private readonly bool escapeSCRIPT = false; // LUCENENET: marked readonly
+ private readonly bool escapeSTYLE = false; // LUCENENET: marked readonly
private int restoreState;
private int previousRestoreState;
private int outputCharCount;
private int eofReturnValue;
- private TextSegment inputSegment = new TextSegment(INITIAL_INPUT_SEGMENT_SIZE);
+ private readonly TextSegment inputSegment = new TextSegment(INITIAL_INPUT_SEGMENT_SIZE); // LUCENENET: marked readonly
private TextSegment outputSegment;
- private TextSegment entitySegment = new TextSegment(2);
+ private readonly TextSegment entitySegment = new TextSegment(2); // LUCENENET: marked readonly
///
/// Creates a new HTMLStripCharFilter over the provided TextReader.
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Cjk/CJKWidthFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Cjk/CJKWidthFilter.cs
index 739c30b42a..1e2284f715 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Cjk/CJKWidthFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Cjk/CJKWidthFilter.cs
@@ -35,13 +35,13 @@ namespace Lucene.Net.Analysis.Cjk
///
public sealed class CJKWidthFilter : TokenFilter
{
- private ICharTermAttribute termAtt;
+ private readonly ICharTermAttribute termAtt; // LUCENENET: marked readonly
///
- /// halfwidth kana mappings: 0xFF65-0xFF9D
+ /// halfwidth kana mappings: 0xFF65-0xFF9D
///
/// note: 0xFF9C and 0xFF9D are only mapped to 0x3099 and 0x309A
- /// as a fallback when they cannot properly combine with a preceding
+ /// as a fallback when they cannot properly combine with a preceding
/// character into a composed form.
///
private static readonly char[] KANA_NORM = new char[] {
@@ -124,4 +124,4 @@ private static bool Combine(char[] text, int pos, char ch)
return false;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Cn/ChineseFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Cn/ChineseFilter.cs
index 36d0a76ea9..ce44bc03d4 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Cn/ChineseFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Cn/ChineseFilter.cs
@@ -25,7 +25,7 @@ namespace Lucene.Net.Analysis.Cn
*/
///
- /// A with a stop word table.
+ /// A with a stop word table.
///
/// Numeric tokens are removed.
/// English tokens must be larger than 1 character.
@@ -39,7 +39,7 @@ namespace Lucene.Net.Analysis.Cn
///
///
/// @deprecated (3.1) Use instead, which has the same functionality.
- /// This filter will be removed in Lucene 5.0
+ /// This filter will be removed in Lucene 5.0
[Obsolete("(3.1) Use StopFilter instead, which has the same functionality.")]
public sealed class ChineseFilter : TokenFilter
{
@@ -52,9 +52,9 @@ public sealed class ChineseFilter : TokenFilter
"they", "this", "to", "was", "will", "with"
};
- private CharArraySet stopTable;
+ private readonly CharArraySet stopTable; // LUCENENET: marked readonly
- private ICharTermAttribute termAtt;
+ private readonly ICharTermAttribute termAtt; // LUCENENET: marked readonly
public ChineseFilter(TokenStream @in)
: base(@in)
@@ -97,4 +97,4 @@ public override bool IncrementToken()
return false;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/ByteVector.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/ByteVector.cs
index aa025163b6..82a0fef094 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/ByteVector.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/ByteVector.cs
@@ -11,9 +11,9 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,7 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
///
/// This class implements a simple byte vector with access to the underlying
/// array.
- /// This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified.
+ /// This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified.
///
public class ByteVector
{
@@ -33,7 +33,7 @@ public class ByteVector
///
private const int DEFAULT_BLOCK_SIZE = 2048;
- private int blockSize;
+ private readonly int blockSize; // LUCENENET: marked readonly
///
/// The encapsulated array
@@ -45,7 +45,7 @@ public class ByteVector
///
private int n;
- public ByteVector()
+ public ByteVector()
: this(DEFAULT_BLOCK_SIZE)
{
}
@@ -148,4 +148,4 @@ public virtual void TrimToSize()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/CharVector.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/CharVector.cs
index 854e053bbe..0bac76692b 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/CharVector.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/CharVector.cs
@@ -12,9 +12,9 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,8 +25,8 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
///
/// This class implements a simple char vector with access to the underlying
/// array.
- ///
- /// This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified.
+ ///
+ /// This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified.
///
public class CharVector // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation
{
@@ -35,7 +35,7 @@ public class CharVector // LUCENENET specific: Not implementing ICloneable per M
///
private const int DEFAULT_BLOCK_SIZE = 2048;
- private int blockSize;
+ private readonly int blockSize; // LUCENENET: marked readonly
///
/// The encapsulated array
@@ -47,7 +47,7 @@ public class CharVector // LUCENENET specific: Not implementing ICloneable per M
///
private int n;
- public CharVector()
+ public CharVector()
: this(DEFAULT_BLOCK_SIZE)
{
}
@@ -160,4 +160,4 @@ public virtual void TrimToSize()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
index 7c73151696..a4833094c5 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
@@ -40,7 +40,7 @@ public class PatternParser
internal IPatternConsumer consumer;
- internal StringBuilder token;
+ internal readonly StringBuilder token; // LUCENENET: marked readonly
internal IList
jb");
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
index 60c2866988..ab33970066 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
@@ -35,7 +35,6 @@
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Analysis.Core
@@ -933,7 +932,7 @@ private T CreateComponent(ConstructorInfo ctor, object[] args, StringBuilder
if (Verbose)
{
Console.WriteLine("Ignoring IAE/UOE from ctor:");
- //cause.printStackTrace(System.err);
+ ite.InnerException.PrintStackTrace(Console.Error);
}
}
else
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestStopFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestStopFilter.cs
index c010241176..3d934cc90a 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestStopFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestStopFilter.cs
@@ -7,7 +7,6 @@
using System;
using System.IO;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
using Version = Lucene.Net.Util.LuceneVersion;
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestTypeTokenFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestTypeTokenFilter.cs
index 722b0bf922..9759f572db 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestTypeTokenFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestTypeTokenFilter.cs
@@ -3,11 +3,11 @@
using Lucene.Net.Analysis.TokenAttributes;
using Lucene.Net.Util;
using NUnit.Framework;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using JCG = J2N.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Analysis.Core
{
@@ -76,7 +76,7 @@ public virtual void TestStopPositons()
reader = new StringReader(sb.ToString());
typeTokenFilter =
#pragma warning disable 612, 618
- new TypeTokenFilter(LuceneVersion.LUCENE_43,
+ new TypeTokenFilter(LuceneVersion.LUCENE_43,
#pragma warning restore 612, 618
false, new StandardTokenizer(TEST_VERSION_CURRENT, reader), stopSet);
TestPositons(typeTokenFilter);
@@ -117,4 +117,4 @@ private static void log(string s)
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries.cs
index 7c3b0f9c6f..df7d4a8fdd 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries.cs
@@ -6,7 +6,6 @@
using System.IO;
using System.IO.Compression;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Analysis.Hunspell
{
@@ -31,12 +30,12 @@ namespace Lucene.Net.Analysis.Hunspell
/// Can be retrieved via:
/// wget --mirror -np http://archive.services.openoffice.org/pub/mirror/OpenOffice.org/contrib/dictionaries/
/// Note some of the files differ only in case. This may be a problem on your operating system!
- ///
+ ///
/// LUCENENET NOTE: The above URL is no longer valid. These dictionaries can be retreived via FTP at one of these URLs
/// ftp://ftp.us.horde.org/pub/software/openoffice/contrib/dictionaries/
/// ftp://mirror.nl.leaseweb.net/openoffice/contrib/dictionaries/
/// ftp://mirror.aptus.co.tz/openoffice/contrib/dictionaries/
- ///
+ ///
/// Or you can search by file name at:
/// http://www.filewatcher.com/
///
@@ -50,7 +49,7 @@ public class TestAllDictionaries : LuceneTestCase
System.IO.Path.Combine(new DirectoryInfo(typeof(TestAllDictionaries2).Assembly.Location).Parent.Parent.Parent.Parent.Parent.Parent.FullName,
@"test-files\analysis\data\dictionaries"));
- internal readonly string[] tests = new string[]
+ internal readonly string[] tests = new string[]
{
/* zip file */ /* dictionary */ /* affix */
"af_ZA.zip", "af_ZA.dic", "af_ZA.aff",
@@ -217,4 +216,4 @@ public virtual void TestOneDictionary()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries2.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries2.cs
index 9501ade107..08f86cc6c5 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries2.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries2.cs
@@ -6,7 +6,6 @@
using System.IO;
using System.IO.Compression;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Analysis.Hunspell
{
@@ -31,9 +30,9 @@ namespace Lucene.Net.Analysis.Hunspell
/// These thunderbird dictionaries can be retrieved via:
/// https://addons.mozilla.org/en-US/thunderbird/language-tools/
/// You must click and download every file: sorry!
- ///
+ ///
/// To retrieve these exact versions, you can search for the
- /// file name at:
+ /// file name at:
/// http://www.filewatcher.com/
///
@@ -232,4 +231,4 @@ public virtual void TestOneDictionary()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternReplaceCharFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternReplaceCharFilter.cs
index d940ed37ca..bf272ae706 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternReplaceCharFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternReplaceCharFilter.cs
@@ -7,7 +7,6 @@
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Analysis.Pattern
{
@@ -224,7 +223,7 @@ private Regex pattern(string p)
}
///
- /// A demonstration of how backtracking regular expressions can lead to relatively
+ /// A demonstration of how backtracking regular expressions can lead to relatively
/// easy DoS attacks.
///
///
@@ -274,4 +273,4 @@ public virtual void TestRandomStrings()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TestTeeSinkTokenFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TestTeeSinkTokenFilter.cs
index e9a1dcf742..cbbc7c7d23 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TestTeeSinkTokenFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TestTeeSinkTokenFilter.cs
@@ -12,7 +12,6 @@
using System.Globalization;
using System.IO;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Analysis.Sinks
{
@@ -84,7 +83,7 @@ public override bool Accept(AttributeSource a)
}
// LUCENE-1448
- // TODO: instead of testing it this way, we can test
+ // TODO: instead of testing it this way, we can test
// with BaseTokenStreamTestCase now...
[Test]
public virtual void TestEndOffsetPositionWithTeeSinkTokenFilter()
@@ -301,4 +300,4 @@ public override bool Accept(AttributeSource a)
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Snowball/TestSnowballVocab.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Snowball/TestSnowballVocab.cs
index 4006706ee1..45d3ca8633 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Snowball/TestSnowballVocab.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Snowball/TestSnowballVocab.cs
@@ -2,7 +2,7 @@
using Lucene.Net.Analysis.Core;
using Lucene.Net.Util;
using NUnit.Framework;
-using Console = Lucene.Net.Util.SystemConsole;
+using System;
namespace Lucene.Net.Analysis.Snowball
{
@@ -38,7 +38,7 @@ public virtual void TestStemmers()
AssertCorrectOutput("Danish", "danish");
AssertCorrectOutput("Dutch", "dutch");
AssertCorrectOutput("English", "english");
- // disabled due to snowball java code generation bug:
+ // disabled due to snowball java code generation bug:
// see http://article.gmane.org/gmane.comp.search.snowball/1139
// assertCorrectOutput("Finnish", "finnish");
AssertCorrectOutput("French", "french");
@@ -47,7 +47,7 @@ public virtual void TestStemmers()
AssertCorrectOutput("Hungarian", "hungarian");
AssertCorrectOutput("Italian", "italian");
AssertCorrectOutput("Kp", "kraaij_pohlmann");
- // disabled due to snowball java code generation bug:
+ // disabled due to snowball java code generation bug:
// see http://article.gmane.org/gmane.comp.search.snowball/1139
// assertCorrectOutput("Lovins", "lovins");
AssertCorrectOutput("Norwegian", "norwegian");
@@ -80,4 +80,4 @@ private void AssertCorrectOutput(string snowballLanguage, string dataDirectory)
VocabularyAssert.AssertVocabulary(a, GetDataFile("TestSnowballVocabData.zip"), dataDirectory + "/voc.txt", dataDirectory + "/output.txt");
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs
index 76b6b9b3d0..f4cc112241 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs
@@ -13,7 +13,6 @@
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Analysis.Synonym
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs
index ce6e3941e2..030ef86466 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs
@@ -429,7 +429,7 @@ public void Test_ReadCII()
//char[] contents = new char[size];
- //public int read()
+ //public int read()
//{
// if (pos >= size)
// throw new IOException("Read past end of data");
@@ -453,7 +453,7 @@ public void Test_ReadCII()
// return size - pos > 0;
//}
- //public void close()
+ //public void close()
//{
//}
// });
@@ -713,12 +713,14 @@ public void Test_ReadLine()
/**
* @tests java.io.BufferedReader#ready()
*/
+ [Test, LuceneNetSpecific]
public void Test_Ready()
{
// Test for method boolean java.io.BufferedReader.ready()
try
{
- br = new BufferedCharFilter(new StringReader(testString));
+ // LUCENENET specific: use TestStringReaderCharFilterAdapter to adapt StringReader to be IsReady-aware.
+ br = new BufferedCharFilter(new TestStringReaderCharFilterAdapter(new StringReader(testString)));
assertTrue("IsReady returned false", br.IsReady);
}
catch (Exception e) when (e.IsIOException())
@@ -727,9 +729,34 @@ public void Test_Ready()
}
}
+ ///
+ /// LUCENENET specific class for to test that
+ /// cascades its call to the underlying
+ /// . Rationale: IsReady indicates that a call to
+ /// is guaranteed not to block. does not block,
+ /// because there is no I/O. Therefore, if the underlying reader is a , then
+ /// must return true.
+ ///
+ private class TestStringReaderCharFilterAdapter : CharFilter
+ {
+ public TestStringReaderCharFilterAdapter(StringReader input) // Enforces the input reader is a StringReader
+ : base(input)
+ {
+ }
+
+ protected override int Correct(int currentOff)
+ => throw new NotImplementedException();
+
+ public override int Read(char[] buffer, int index, int count)
+ => m_input.Read(buffer, index, count);
+
+ public override bool IsReady => true; // StringReaders do not block
+ }
+
/**
* @tests java.io.BufferedReader#reset()
*/
+ [Test, LuceneNetSpecific]
public void Test_Reset()
{
// Test for method void java.io.BufferedReader.reset()
@@ -850,4 +877,4 @@ public override void TearDown()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestRollingCharBuffer.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestRollingCharBuffer.cs
index f5a751316c..648dac9440 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestRollingCharBuffer.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestRollingCharBuffer.cs
@@ -2,8 +2,8 @@
using Lucene.Net.Util;
using NUnit.Framework;
using RandomizedTesting.Generators;
+using System;
using System.IO;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Analysis.Util
{
@@ -45,9 +45,9 @@ public virtual void Test()
var random = LuceneTestCase.Random;
for (var iter = 0; iter < ITERS; iter++)
- {
+ {
var stringLen = random.NextBoolean() ? random.Next(50) : random.Next(20000);
-
+
string s;
if (stringLen == 0)
{
@@ -134,4 +134,4 @@ public virtual void Test()
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Analysis.ICU/Analysis/Icu/Segmentation/TestICUTokenizer.cs b/src/Lucene.Net.Tests.Analysis.ICU/Analysis/Icu/Segmentation/TestICUTokenizer.cs
index 5a6fbfbfef..65ab03f53f 100644
--- a/src/Lucene.Net.Tests.Analysis.ICU/Analysis/Icu/Segmentation/TestICUTokenizer.cs
+++ b/src/Lucene.Net.Tests.Analysis.ICU/Analysis/Icu/Segmentation/TestICUTokenizer.cs
@@ -157,7 +157,7 @@ public void TestLao()
}
[Test]
- public void TestMyanmar()
+ public void TestMyanmar()
{
AssertAnalyzesTo(a, "သက်ဝင်လှုပ်ရှားစေပြီး", new String[] { "သက်ဝင်", "လှုပ်ရှား", "စေ", "ပြီး" });
}
@@ -383,7 +383,7 @@ public override void Run()
if (Verbose)
{
- SystemConsole.Out.WriteLine(tokenCount);
+ Console.Out.WriteLine(tokenCount);
}
}
}
@@ -414,4 +414,4 @@ public void TestICUConcurrency()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Analysis.Kuromoji/Dict/TestTokenInfoDictionary.cs b/src/Lucene.Net.Tests.Analysis.Kuromoji/Dict/TestTokenInfoDictionary.cs
index d576292c9d..2a2a7c6f8b 100644
--- a/src/Lucene.Net.Tests.Analysis.Kuromoji/Dict/TestTokenInfoDictionary.cs
+++ b/src/Lucene.Net.Tests.Analysis.Kuromoji/Dict/TestTokenInfoDictionary.cs
@@ -3,7 +3,6 @@
using Lucene.Net.Util.Fst;
using NUnit.Framework;
using System;
-using Console = Lucene.Net.Util.SystemConsole;
using Int64 = J2N.Numerics.Int64;
namespace Lucene.Net.Analysis.Ja.Dict
diff --git a/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs b/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs
index f649a03d13..be794d4abb 100644
--- a/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs
+++ b/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs
@@ -13,7 +13,6 @@
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Analysis.Ja
{
diff --git a/src/Lucene.Net.Tests.Analysis.Kuromoji/TestSearchMode.cs b/src/Lucene.Net.Tests.Analysis.Kuromoji/TestSearchMode.cs
index bc9c61fb06..a7647710b0 100644
--- a/src/Lucene.Net.Tests.Analysis.Kuromoji/TestSearchMode.cs
+++ b/src/Lucene.Net.Tests.Analysis.Kuromoji/TestSearchMode.cs
@@ -4,7 +4,6 @@
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Analysis.Ja
{
diff --git a/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/CacheSubSequencePerformanceTest.cs b/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/CacheSubSequencePerformanceTest.cs
index 101405be11..ec899c7a06 100644
--- a/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/CacheSubSequencePerformanceTest.cs
+++ b/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/CacheSubSequencePerformanceTest.cs
@@ -1,9 +1,9 @@
using J2N.Text;
using Lucene.Net.Util;
using NUnit.Framework;
+using System;
using System.Diagnostics;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Analysis.Phonetic.Language.Bm
{
diff --git a/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/PhoneticEnginePerformanceTest.cs b/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/PhoneticEnginePerformanceTest.cs
index 728d1052d0..45c36df7d0 100644
--- a/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/PhoneticEnginePerformanceTest.cs
+++ b/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/PhoneticEnginePerformanceTest.cs
@@ -1,7 +1,7 @@
using Lucene.Net.Util;
using NUnit.Framework;
+using System;
using System.Diagnostics;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Analysis.Phonetic.Language.Bm
{
diff --git a/src/Lucene.Net.Tests.Benchmark/BenchmarkTestCase.cs b/src/Lucene.Net.Tests.Benchmark/BenchmarkTestCase.cs
index de12cf0c5a..e38d739f43 100644
--- a/src/Lucene.Net.Tests.Benchmark/BenchmarkTestCase.cs
+++ b/src/Lucene.Net.Tests.Benchmark/BenchmarkTestCase.cs
@@ -3,7 +3,6 @@
using System;
using System.IO;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Benchmarks
{
diff --git a/src/Lucene.Net.Tests.Benchmark/ByTask/Tasks/CreateIndexTaskTest.cs b/src/Lucene.Net.Tests.Benchmark/ByTask/Tasks/CreateIndexTaskTest.cs
index 169b781504..eb96b5240c 100644
--- a/src/Lucene.Net.Tests.Benchmark/ByTask/Tasks/CreateIndexTaskTest.cs
+++ b/src/Lucene.Net.Tests.Benchmark/ByTask/Tasks/CreateIndexTaskTest.cs
@@ -7,7 +7,6 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Benchmarks.ByTask.Tasks
{
@@ -56,7 +55,7 @@ public void TestInfoStream_SystemOutErr()
TextWriter curOut = Console.Out;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- Console.Out = new StreamWriter(baos, Encoding.Default);
+ Console.SetOut(new StreamWriter(baos, Encoding.Default));
try
{
PerfRunData runData = createPerfRunData("SystemOut");
@@ -67,12 +66,12 @@ public void TestInfoStream_SystemOutErr()
}
finally
{
- Console.Out = curOut;
+ Console.SetOut(curOut);
}
TextWriter curErr = Console.Error;
baos = new ByteArrayOutputStream();
- Console.Error = new StreamWriter(baos, Encoding.Default);
+ Console.SetError(new StreamWriter(baos, Encoding.Default));
try
{
PerfRunData runData = createPerfRunData("SystemErr");
@@ -83,7 +82,7 @@ public void TestInfoStream_SystemOutErr()
}
finally
{
- Console.Error = curErr;
+ Console.SetError(curErr);
}
}
diff --git a/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs b/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs
index 00b84947ab..3ab9e7e751 100644
--- a/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs
+++ b/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs
@@ -63,19 +63,19 @@ public virtual void TestDefaultList()
public virtual void TestNoArgMethod()
{
IDictionary functions = new Dictionary();
- functions["foo"] = GetType().GetMethod("ZeroArgMethod");
+ functions["foo"] = GetType().GetMethod(nameof(ZeroArgMethod));
var expr = JavascriptCompiler.Compile("foo()", functions);
Assert.AreEqual(5, expr.Evaluate(0, null), DELTA);
}
- public static double OneArgMethod(double arg1) => 3 + arg1;
+ public static double OneArgMethod(double arg1) => 3 + arg1;
/// tests a method with one arguments
[Test]
public virtual void TestOneArgMethod()
{
IDictionary functions = new Dictionary();
- functions["foo"] = GetType().GetMethod("OneArgMethod", new []{ typeof(double)});
+ functions["foo"] = GetType().GetMethod(nameof(OneArgMethod), new []{ typeof(double)});
var expr = JavascriptCompiler.Compile("foo(3)", functions);
Assert.AreEqual(6, expr.Evaluate(0, null), DELTA);
}
@@ -87,7 +87,7 @@ public virtual void TestOneArgMethod()
public virtual void TestThreeArgMethod()
{
IDictionary functions = new Dictionary();
- functions["foo"] = GetType().GetMethod("ThreeArgMethod", new []{ typeof(double), typeof(double), typeof(double)});
+ functions["foo"] = GetType().GetMethod(nameof(ThreeArgMethod), new []{ typeof(double), typeof(double), typeof(double)});
var expr = JavascriptCompiler.Compile("foo(3, 4, 5)", functions);
Assert.AreEqual(12, expr.Evaluate(0, null), DELTA);
}
@@ -97,20 +97,20 @@ public virtual void TestThreeArgMethod()
public virtual void TestTwoMethods()
{
IDictionary functions = new Dictionary();
- functions["foo"] = GetType().GetMethod("ZeroArgMethod");
- functions["bar"] = GetType().GetMethod("OneArgMethod", new []{typeof(double)});
+ functions["foo"] = GetType().GetMethod(nameof(ZeroArgMethod));
+ functions["bar"] = GetType().GetMethod(nameof(OneArgMethod), new[] { typeof(double) });
var expr = JavascriptCompiler.Compile("foo() + bar(3)", functions);
Assert.AreEqual(11, expr.Evaluate(0, null), DELTA);
}
- public static string BogusReturnType() => "bogus!";
+ public static string BogusReturnType() => "bogus!";
/// wrong return type: must be double
[Test]
public virtual void TestWrongReturnType()
{
IDictionary functions = new Dictionary();
- functions["foo"] = GetType().GetMethod("BogusReturnType");
+ functions["foo"] = GetType().GetMethod(nameof(BogusReturnType));
try
{
JavascriptCompiler.Compile("foo()", functions);
@@ -122,14 +122,14 @@ public virtual void TestWrongReturnType()
}
}
- public static double BogusParameterType(string s) => 0;
+ public static double BogusParameterType(string s) => 0;
/// wrong param type: must be doubles
[Test]
public virtual void TestWrongParameterType()
{
IDictionary functions = new Dictionary();
- functions["foo"] = GetType().GetMethod("BogusParameterType", new []{ typeof(string)});
+ functions["foo"] = GetType().GetMethod(nameof(BogusParameterType), new[] { typeof(string) });
try
{
JavascriptCompiler.Compile("foo(2)", functions);
@@ -141,14 +141,14 @@ public virtual void TestWrongParameterType()
}
}
- public virtual double NonStaticMethod() => 0;
+ public virtual double NonStaticMethod() => 0;
/// wrong modifiers: must be static
[Test]
public virtual void TestWrongNotStatic()
{
IDictionary functions = new Dictionary();
- functions["foo"] = GetType().GetMethod("NonStaticMethod");
+ functions["foo"] = GetType().GetMethod(nameof(NonStaticMethod));
try
{
JavascriptCompiler.Compile("foo()", functions);
@@ -167,8 +167,8 @@ public virtual void TestWrongNotStatic()
public virtual void TestWrongNotPublic()
{
IDictionary functions = new Dictionary();
- functions["foo"] = GetType().GetMethod("NonPublicMethod",BindingFlags.NonPublic|BindingFlags.Static);
-
+ functions["foo"] = GetType().GetMethod(nameof(NonPublicMethod), BindingFlags.NonPublic | BindingFlags.Static);
+
try
{
JavascriptCompiler.Compile("foo()", functions);
@@ -190,7 +190,7 @@ internal class NestedNotPublic
public virtual void TestWrongNestedNotPublic()
{
IDictionary functions = new Dictionary();
- functions["foo"] = typeof(NestedNotPublic).GetMethod("Method");
+ functions["foo"] = typeof(NestedNotPublic).GetMethod(nameof(NestedNotPublic.Method));
try
{
JavascriptCompiler.Compile("foo()", functions);
@@ -204,8 +204,8 @@ public virtual void TestWrongNestedNotPublic()
//LUCENENET: testClassLoader() was not ported. (May not apply to Lucene.Net)
-
-
+
+
internal static string MESSAGE = "This should not happen but it happens";
public static class StaticThrowingException // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable
@@ -223,8 +223,8 @@ public static double Method()
public virtual void TestThrowingException()
{
IDictionary functions = new Dictionary();
- functions["foo"] = typeof(StaticThrowingException).GetMethod("Method");
- string source = "3 * foo() / 5";
+ functions["foo"] = typeof(StaticThrowingException).GetMethod(nameof(StaticThrowingException.Method));
+ const string source = "3 * foo() / 5";
var expr = JavascriptCompiler.Compile(source, functions);
try
{
@@ -234,14 +234,16 @@ public virtual void TestThrowingException()
catch (Exception e) when (e.IsArithmeticException())
{
Assert.AreEqual(MESSAGE, e.Message);
- StringWriter sw = new StringWriter();
- e.printStackTrace();
+ using StringWriter sw = new StringWriter();
+ e.PrintStackTrace(sw);
+ sw.Flush();
//.NET Port
+ var swString = sw.ToString();
Assert.IsTrue(
// LUCENENET: Apparently in .NET 7, they finally fixed this weird display issue with spaces before the comma
// and closing parenthesis. It is a pass.
- e.StackTrace.Contains("Lucene.Net.Expressions.CompiledExpression.Evaluate(Int32, FunctionValues[])") ||
- e.StackTrace.Contains("Lucene.Net.Expressions.CompiledExpression.Evaluate(Int32 , FunctionValues[] )")
+ swString.Contains("Lucene.Net.Expressions.CompiledExpression.Evaluate(Int32, FunctionValues[])") ||
+ swString.Contains("Lucene.Net.Expressions.CompiledExpression.Evaluate(Int32 , FunctionValues[] )")
);
}
}
@@ -252,7 +254,7 @@ public virtual void TestNamespaces()
{
IDictionary functions = new Dictionary();
functions["foo.bar"] = GetType().GetMethod("ZeroArgMethod");
- string source = "foo.bar()";
+ const string source = "foo.bar()";
var expr = JavascriptCompiler.Compile(source, functions);
Assert.AreEqual(5, expr.Evaluate(0, null), DELTA);
}
diff --git a/src/Lucene.Net.Tests.Facet/FacetTestCase.cs b/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
index 871a626581..b1b088325f 100644
--- a/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
+++ b/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
@@ -7,7 +7,6 @@
using System.Collections.Generic;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Facet
{
@@ -170,7 +169,7 @@ protected internal virtual void SortTies(LabelAndValue[] labelValues)
i++;
}
}
-
+
protected internal virtual void SortLabelValues(JCG.List labelValues)
{
labelValues.Sort(Comparer.Create((a,b) => {
@@ -189,7 +188,7 @@ protected internal virtual void SortLabelValues(JCG.List labelVal
}));
}
-
+
protected internal virtual void SortFacetResults(JCG.List results)
{
results.Sort(Comparer.Create((a, b) =>
@@ -248,4 +247,4 @@ protected virtual void AssertFloatValuesEquals(FacetResult a, FacetResult b)
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs b/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs
index fba5e06250..00339206a1 100644
--- a/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs
+++ b/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs
@@ -8,7 +8,6 @@
using System.Collections;
using System.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Facet.Range
{
diff --git a/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs b/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs
index fac9d4dc77..a63fca08ed 100644
--- a/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs
+++ b/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs
@@ -5,7 +5,6 @@
using System.Collections.Generic;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Facet.SortedSet
{
@@ -388,4 +387,4 @@ public virtual void TestRandom()
IOUtils.Dispose(w, searcher.IndexReader, indexDir, taxoDir);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs
index ce33e095e0..670302194d 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs
@@ -5,7 +5,6 @@
using System.IO;
using NUnit.Framework;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using J2N.Threading;
namespace Lucene.Net.Facet.Taxonomy.Directory
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
index dbc100138f..d2a36f031e 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
@@ -9,7 +9,6 @@
using System.Globalization;
using System.IO;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Facet.Taxonomy.Directory
{
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs
index 2a827b7894..46d3b98b60 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs
@@ -11,7 +11,6 @@
using System.IO;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Facet.Taxonomy
@@ -256,7 +255,7 @@ public override void Run()
}
}
-
+
[Test]
[Slow]
[Timeout(2_400_000)] // 40 minutes
@@ -401,4 +400,4 @@ public virtual void TestReplaceTaxonomyDirectory()
IOUtils.Dispose(mgr, tw, w, taxoDir, indexDir);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
index 2d1ac3580e..9de607eb1b 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
@@ -5,6 +5,7 @@
using NUnit.Framework;
using System;
using System.Globalization;
+using System.IO;
using System.Text;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
@@ -860,7 +861,7 @@ private void AssertConsistentYoungestChild(FacetLabel abPath, int abOrd, int abY
stop.Value = true;
thread.Join();
- Assert.IsNull(error[0], "Unexpcted exception at retry " + retry + " retrieval " + retrieval[0] + ": \n" + stackTraceStr(error[0]));
+ Assert.IsNull(error[0], "Unexpcted exception at retry " + retry + " retrieval " + retrieval[0] + ": \n" + StackTraceStr(error[0]));
tr.Dispose();
}
@@ -926,15 +927,20 @@ private void AssertChildrenArrays(ParallelTaxonomyArrays ca, int retry, int retr
/// Grab the stack trace into a string since the exception was thrown in a thread and we want the assert
/// outside the thread to show the stack trace in case of failure.
///
- private string stackTraceStr(Exception error)
+ // LUCENENET specific - made static
+ private static string StackTraceStr(Exception error)
{
if (error is null)
{
return "";
}
- error.printStackTrace();
- return error.StackTrace;
+ // LUCENENET specific - we can just return e.ToString() here to get the Java equivalent with less allocations. would otherwise be:
+ // using var sw = new StringWriter();
+ // error.PrintStackTrace(sw);
+ // sw.Flush();
+ // return sw.ToString();
+ return error.ToString();
}
///
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
index 02f8764f7b..fa3a12ec7d 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
@@ -9,7 +9,6 @@
using System.IO;
using System.Text;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Facet.Taxonomy
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs
index 01628b91fb..6ed24e9e2f 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs
@@ -10,7 +10,6 @@
using System.Runtime.CompilerServices;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Facet.Taxonomy
{
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/WriterCache/TestCompactLabelToOrdinal.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/WriterCache/TestCompactLabelToOrdinal.cs
index d38b1fd459..43eeb9b239 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/WriterCache/TestCompactLabelToOrdinal.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/WriterCache/TestCompactLabelToOrdinal.cs
@@ -7,7 +7,6 @@
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Facet.Taxonomy.WriterCache
{
diff --git a/src/Lucene.Net.Tests.Facet/TestDrillSideways.cs b/src/Lucene.Net.Tests.Facet/TestDrillSideways.cs
index 79d3332f59..65d3e39f33 100644
--- a/src/Lucene.Net.Tests.Facet/TestDrillSideways.cs
+++ b/src/Lucene.Net.Tests.Facet/TestDrillSideways.cs
@@ -11,7 +11,6 @@
using System.Globalization;
using System.Linq;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Facet
diff --git a/src/Lucene.Net.Tests.Grouping/AllGroupHeadsCollectorTest.cs b/src/Lucene.Net.Tests.Grouping/AllGroupHeadsCollectorTest.cs
index 6b495609cf..e21f1b3995 100644
--- a/src/Lucene.Net.Tests.Grouping/AllGroupHeadsCollectorTest.cs
+++ b/src/Lucene.Net.Tests.Grouping/AllGroupHeadsCollectorTest.cs
@@ -14,7 +14,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Search.Grouping
diff --git a/src/Lucene.Net.Tests.Grouping/AllGroupsCollectorTest.cs b/src/Lucene.Net.Tests.Grouping/AllGroupsCollectorTest.cs
index 6fb45fbf22..b4328aadee 100644
--- a/src/Lucene.Net.Tests.Grouping/AllGroupsCollectorTest.cs
+++ b/src/Lucene.Net.Tests.Grouping/AllGroupsCollectorTest.cs
@@ -12,7 +12,6 @@
using NUnit.Framework;
using System;
using System.Collections;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search.Grouping
{
diff --git a/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs b/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs
index feb90269df..5fa1dbfa06 100644
--- a/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs
+++ b/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs
@@ -14,7 +14,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Search.Grouping
diff --git a/src/Lucene.Net.Tests.Grouping/GroupFacetCollectorTest.cs b/src/Lucene.Net.Tests.Grouping/GroupFacetCollectorTest.cs
index a4c5ae0690..57316e30bd 100644
--- a/src/Lucene.Net.Tests.Grouping/GroupFacetCollectorTest.cs
+++ b/src/Lucene.Net.Tests.Grouping/GroupFacetCollectorTest.cs
@@ -13,7 +13,6 @@
using System.Collections.Generic;
using System.Globalization;
using Collections = Lucene.Net.Support.Collections;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
@@ -602,7 +601,7 @@ private IndexContext CreateIndexContext(bool multipleFacetValuesPerDocument)
return a.CompareToOrdinal(b);
}
}));
-
+
// LUCENENET NOTE: Need JCG.Dictionary here because of null keys
IDictionary>> searchTermToFacetToGroups = new Dictionary>>();
int facetWithMostGroups = 0;
diff --git a/src/Lucene.Net.Tests.Grouping/TestGrouping.cs b/src/Lucene.Net.Tests.Grouping/TestGrouping.cs
index 3cfb50a896..9c05cb35d6 100644
--- a/src/Lucene.Net.Tests.Grouping/TestGrouping.cs
+++ b/src/Lucene.Net.Tests.Grouping/TestGrouping.cs
@@ -39,7 +39,6 @@
using System.Globalization;
using System.Linq;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Search.Grouping
@@ -252,7 +251,7 @@ private IAbstractSecondPassGroupingCollector CreateSecondPassCollector(IAb
{
if (firstPassGroupingCollector.GetType().IsAssignableFrom(typeof(TermFirstPassGroupingCollector)))
{
- return new TermSecondPassGroupingCollector(groupField, searchGroups, groupSort, sortWithinGroup, maxDocsPerGroup, getScores, getMaxScores, fillSortFields)
+ return new TermSecondPassGroupingCollector(groupField, searchGroups, groupSort, sortWithinGroup, maxDocsPerGroup, getScores, getMaxScores, fillSortFields)
as IAbstractSecondPassGroupingCollector;
}
else
@@ -340,7 +339,7 @@ private IEnumerable> GetSearchGroups(IAbstractFirstPas
}
else if (typeof(FunctionFirstPassGroupingCollector).IsAssignableFrom(c.GetType())) // LUCENENET Specific type for generic must be specified.
{
- // LUCENENET NOTE: This is IEnumerable instead of ICollection because it
+ // LUCENENET NOTE: This is IEnumerable instead of ICollection because it
// needs to be covariant to mimic the wildcard generics in Java
IEnumerable> mutableValueGroups = ((FunctionFirstPassGroupingCollector)c).GetTopGroups(groupOffset, fillFields); // LUCENENET Specific type for generic must be specified.
if (mutableValueGroups is null)
@@ -551,7 +550,7 @@ private TopGroups SlowGrouping(GroupDoc[] groupDocs,
// when the values differ.
//Arrays.Sort(groupDocs, groupSortComp);
ArrayUtil.TimSort(groupDocs, groupSortComp);
-
+
IDictionary> groups = new JCG.Dictionary>();
IList sortedGroups = new JCG.List();
IList sortedGroupFields = new JCG.List();
diff --git a/src/Lucene.Net.Tests.Highlighter/Highlight/Custom/HighlightCustomQueryTest.cs b/src/Lucene.Net.Tests.Highlighter/Highlight/Custom/HighlightCustomQueryTest.cs
index 0f8d3875d8..478511b270 100644
--- a/src/Lucene.Net.Tests.Highlighter/Highlight/Custom/HighlightCustomQueryTest.cs
+++ b/src/Lucene.Net.Tests.Highlighter/Highlight/Custom/HighlightCustomQueryTest.cs
@@ -4,7 +4,6 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search.Highlight.Custom
{
diff --git a/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs b/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
index 0644f95336..bb86e2d902 100644
--- a/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
+++ b/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
@@ -19,7 +19,6 @@
using System.Text;
using System.Xml;
using JCG = J2N.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search.Highlight
{
diff --git a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragListBuilderTest.cs b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragListBuilderTest.cs
index 186184d65f..bfab063b73 100644
--- a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragListBuilderTest.cs
+++ b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragListBuilderTest.cs
@@ -2,7 +2,6 @@
using NUnit.Framework;
using System;
using System.Globalization;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search.VectorHighlight
{
diff --git a/src/Lucene.Net.Tests.Join/Support/TestBlockJoin.cs b/src/Lucene.Net.Tests.Join/Support/TestBlockJoin.cs
index 524253e8c7..5f3b10a029 100644
--- a/src/Lucene.Net.Tests.Join/Support/TestBlockJoin.cs
+++ b/src/Lucene.Net.Tests.Join/Support/TestBlockJoin.cs
@@ -17,7 +17,6 @@
using System.Globalization;
using System.Linq;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Tests.Join
{
diff --git a/src/Lucene.Net.Tests.Join/Support/TestJoinUtil.cs b/src/Lucene.Net.Tests.Join/Support/TestJoinUtil.cs
index 7b0ee0d718..68cefb53b5 100644
--- a/src/Lucene.Net.Tests.Join/Support/TestJoinUtil.cs
+++ b/src/Lucene.Net.Tests.Join/Support/TestJoinUtil.cs
@@ -13,7 +13,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Tests.Join
diff --git a/src/Lucene.Net.Tests.Join/TestBlockJoin.cs b/src/Lucene.Net.Tests.Join/TestBlockJoin.cs
index b8f5704ac0..6cd854c06e 100644
--- a/src/Lucene.Net.Tests.Join/TestBlockJoin.cs
+++ b/src/Lucene.Net.Tests.Join/TestBlockJoin.cs
@@ -16,7 +16,6 @@
using System.Linq;
using System.Text;
using JCG = J2N.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search.Join
{
diff --git a/src/Lucene.Net.Tests.Join/TestJoinUtil.cs b/src/Lucene.Net.Tests.Join/TestJoinUtil.cs
index 69d2d27380..320de70392 100644
--- a/src/Lucene.Net.Tests.Join/TestJoinUtil.cs
+++ b/src/Lucene.Net.Tests.Join/TestJoinUtil.cs
@@ -11,7 +11,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Search.Join
diff --git a/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs b/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs
index f80fd19589..48510f068a 100644
--- a/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs
+++ b/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs
@@ -36,7 +36,6 @@
using System.IO;
using System.Text;
using JCG = J2N.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index.Memory
{
diff --git a/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs b/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
index 43d0b33088..8fb3eac857 100644
--- a/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
+++ b/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
@@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using JCG = J2N.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Documents
{
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs
index 2bd75ecf10..f8595e26ca 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs
@@ -6,7 +6,6 @@
using System.Collections.Generic;
using System.Globalization;
using JCG = J2N.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index.Sorter
{
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
index f3aeb27246..9c70157327 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
@@ -12,7 +12,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Index.Sorter
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs
index 678c5ad189..ddf995dfa0 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs
@@ -3,7 +3,6 @@
using Lucene.Net.Util;
using NUnit.Framework;
using System;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index.Sorter
{
diff --git a/src/Lucene.Net.Tests.Misc/Util/Fst/TestFSTsMisc.cs b/src/Lucene.Net.Tests.Misc/Util/Fst/TestFSTsMisc.cs
index 185120611a..ee0171b64f 100644
--- a/src/Lucene.Net.Tests.Misc/Util/Fst/TestFSTsMisc.cs
+++ b/src/Lucene.Net.Tests.Misc/Util/Fst/TestFSTsMisc.cs
@@ -5,7 +5,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
using Int64 = J2N.Numerics.Int64;
@@ -128,7 +127,7 @@ private void DoTest(int inputMode, Int32sRef[] terms)
{
Console.WriteLine("TEST: now test OneOrMoreOutputs");
}
- PositiveInt32Outputs _outputs = PositiveInt32Outputs.Singleton;
+ PositiveInt32Outputs _outputs = PositiveInt32Outputs.Singleton;
ListOfOutputs outputs2 = new ListOfOutputs(_outputs);
IList> pairs2 = new JCG.List>(terms.Length);
long lastOutput2 = 0;
diff --git a/src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs b/src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs
index c445a72de5..aac0728ed5 100644
--- a/src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs
+++ b/src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs
@@ -9,7 +9,6 @@
using Lucene.Net.Store;
using Lucene.Net.Util;
using NUnit.Framework;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Tests.Queries.Function
{
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParserSimpleSample.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParserSimpleSample.cs
index 10fcf32b30..5fad5872b2 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParserSimpleSample.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParserSimpleSample.cs
@@ -7,7 +7,6 @@
using Lucene.Net.Util;
using NUnit.Framework;
using System;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.QueryParsers.Flexible.Spans
{
@@ -55,10 +54,10 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
/// compound by 2 processors: and
/// .
///
- /// : as it's going to use the current
+ /// : as it's going to use the current
/// query parser to parse the syntax, it will support more features than we want,
/// this processor basically validates the query node tree generated by the parser
- /// and just let got through the elements we want, all the other elements as
+ /// and just let got through the elements we want, all the other elements as
/// wildcards, range queries, etc...if found, an exception is thrown.
///
/// : this processor will take care of reading
@@ -71,7 +70,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
/// objects from objects.
///
/// for a more advanced example
- ///
+ ///
///
///
///
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
index 797e02d549..4edc63f05f 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
@@ -14,7 +14,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
#nullable enable
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
index 2a20ef5611..a63fdd8b7f 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
@@ -19,7 +19,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.QueryParsers.Flexible.Standard
{
diff --git a/src/Lucene.Net.Tests.QueryParser/Support/Flexible/Standard/Config/TestNumberDateFormat.cs b/src/Lucene.Net.Tests.QueryParser/Support/Flexible/Standard/Config/TestNumberDateFormat.cs
index 15d8affbd0..1e82d90220 100644
--- a/src/Lucene.Net.Tests.QueryParser/Support/Flexible/Standard/Config/TestNumberDateFormat.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Support/Flexible/Standard/Config/TestNumberDateFormat.cs
@@ -10,7 +10,6 @@
using Lucene.Net.Util;
using TimeZoneConverter;
using NUnit.Framework;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.QueryParsers.Flexible.Standard.Config
diff --git a/src/Lucene.Net.Tests.QueryParser/Surround/Query/BooleanQueryTst.cs b/src/Lucene.Net.Tests.QueryParser/Surround/Query/BooleanQueryTst.cs
index a8bd471536..46ac44c6fb 100644
--- a/src/Lucene.Net.Tests.QueryParser/Surround/Query/BooleanQueryTst.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Surround/Query/BooleanQueryTst.cs
@@ -1,8 +1,8 @@
using Lucene.Net.Index;
using Lucene.Net.Search;
+using System;
using System.Diagnostics.CodeAnalysis;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.QueryParsers.Surround.Query
{
diff --git a/src/Lucene.Net.Tests.QueryParser/Surround/Query/ExceptionQueryTst.cs b/src/Lucene.Net.Tests.QueryParser/Surround/Query/ExceptionQueryTst.cs
index 91ba9522b9..f53bd2de35 100644
--- a/src/Lucene.Net.Tests.QueryParser/Surround/Query/ExceptionQueryTst.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Surround/Query/ExceptionQueryTst.cs
@@ -1,7 +1,6 @@
using Lucene.Net.QueryParsers.Surround.Parser;
using System;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.QueryParsers.Surround.Query
{
diff --git a/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs b/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
index 142367c183..29e43097ed 100644
--- a/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
@@ -34,7 +34,6 @@
using NUnit.Framework;
using System;
using System.Globalization;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.QueryParsers.Util
{
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs b/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
index 5bb9c16dc6..6f0c77055a 100644
--- a/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
@@ -9,7 +9,6 @@
using System.IO;
using System.Reflection;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.QueryParsers.Xml
{
diff --git a/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyReplicationClientTest.cs b/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyReplicationClientTest.cs
index bfc219bea0..861b3b5a06 100644
--- a/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyReplicationClientTest.cs
+++ b/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyReplicationClientTest.cs
@@ -17,7 +17,6 @@
using System.IO;
using System.Runtime.ExceptionServices;
using System.Threading;
-using Console = Lucene.Net.Util.SystemConsole;
using Directory = Lucene.Net.Store.Directory;
namespace Lucene.Net.Replicator
@@ -445,7 +444,8 @@ protected override void HandleUpdateException(Exception exception)
{
if (Verbose)
{
- Console.WriteLine("hit exception during update: " + exception);
+ Console.WriteLine("hit exception during update: " + exception.ToTypeMessageString()); // LUCENENET specific - use ToTypeMessageString to mimic Java behavior
+ exception.PrintStackTrace(Console.Out);
}
// test that the index can be read and also some basic statistics
diff --git a/src/Lucene.Net.Tests.Replicator/IndexReplicationClientTest.cs b/src/Lucene.Net.Tests.Replicator/IndexReplicationClientTest.cs
index 01085c8636..d7af81c7fa 100644
--- a/src/Lucene.Net.Tests.Replicator/IndexReplicationClientTest.cs
+++ b/src/Lucene.Net.Tests.Replicator/IndexReplicationClientTest.cs
@@ -13,7 +13,6 @@
using System.IO;
using System.Runtime.ExceptionServices;
using System.Threading;
-using Console = Lucene.Net.Util.SystemConsole;
using Directory = Lucene.Net.Store.Directory;
namespace Lucene.Net.Replicator
@@ -273,7 +272,7 @@ public void TestConsistencyOnExceptions()
}
// disable errors -- maybe randomness didn't exhaust all allowed failures,
- // and we don't want e.g. CheckIndex to hit false errors.
+ // and we don't want e.g. CheckIndex to hit false errors.
handlerDir.MaxSizeInBytes = 0;
handlerDir.RandomIOExceptionRate = 0.0;
handlerDir.RandomIOExceptionRateOnOpen = 0.0;
@@ -352,7 +351,8 @@ protected override void HandleUpdateException(Exception exception)
{
if (Verbose)
{
- Console.WriteLine("hit exception during update: " + exception);
+ Console.WriteLine("hit exception during update: " + exception.ToTypeMessageString()); // LUCENENET specific - use ToTypeMessageString to mimic Java behavior
+ exception.PrintStackTrace(Console.Out);
}
try
@@ -406,4 +406,4 @@ protected override void HandleUpdateException(Exception exception)
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests.Sandbox/Queries/TestSlowFuzzyQuery2.cs b/src/Lucene.Net.Tests.Sandbox/Queries/TestSlowFuzzyQuery2.cs
index 949a57cef0..494fc22f8d 100644
--- a/src/Lucene.Net.Tests.Sandbox/Queries/TestSlowFuzzyQuery2.cs
+++ b/src/Lucene.Net.Tests.Sandbox/Queries/TestSlowFuzzyQuery2.cs
@@ -14,7 +14,6 @@
using System.Linq;
using System.Reflection;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Sandbox.Queries
{
@@ -35,26 +34,26 @@ namespace Lucene.Net.Sandbox.Queries
* limitations under the License.
*/
- /**
- * Tests the results of fuzzy against pre-recorded output
+ /**
+ * Tests the results of fuzzy against pre-recorded output
* The format of the file is the following:
- *
- * Header Row: # of bits: generate 2^n sequential documents
+ *
+ * Header Row: # of bits: generate 2^n sequential documents
* with a value of Integer.toBinaryString
- *
+ *
* Entries: an entry is a param spec line, a resultCount line, and
* then 'resultCount' results lines. The results lines are in the
* expected order.
- *
+ *
* param spec line: a comma-separated list of params to FuzzyQuery
* (query, prefixLen, pqSize, minScore)
* query = query text as a number (expand with Integer.toBinaryString)
* prefixLen = prefix length
* pqSize = priority queue maximum size for TopTermsBoostOnlyBooleanQueryRewrite
* minScore = minimum similarity
- *
+ *
* resultCount line: total number of expected hits.
- *
+ *
* results line: comma-separated docID, score pair
**/
public class TestSlowFuzzyQuery2 : LuceneTestCase
diff --git a/src/Lucene.Net.Tests.Spatial/Prefix/NtsPolygonTest.cs b/src/Lucene.Net.Tests.Spatial/Prefix/NtsPolygonTest.cs
index 884d4c2c71..7a25716fd4 100644
--- a/src/Lucene.Net.Tests.Spatial/Prefix/NtsPolygonTest.cs
+++ b/src/Lucene.Net.Tests.Spatial/Prefix/NtsPolygonTest.cs
@@ -9,7 +9,6 @@
using Spatial4n.Shapes;
using System;
using System.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Spatial.Prefix
{
diff --git a/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs b/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs
index bd152d1f07..b1e3fe2109 100644
--- a/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs
+++ b/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs
@@ -10,7 +10,6 @@
using System.Collections.Generic;
using System.Linq;
using JCG = J2N.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Spatial.Prefix
{
diff --git a/src/Lucene.Net.Tests.Spatial/Prefix/Tree/SpatialPrefixTreeTest.cs b/src/Lucene.Net.Tests.Spatial/Prefix/Tree/SpatialPrefixTreeTest.cs
index 870d3a226e..9cfa9d6a64 100644
--- a/src/Lucene.Net.Tests.Spatial/Prefix/Tree/SpatialPrefixTreeTest.cs
+++ b/src/Lucene.Net.Tests.Spatial/Prefix/Tree/SpatialPrefixTreeTest.cs
@@ -5,7 +5,6 @@
using Spatial4n.Context;
using Spatial4n.Shapes;
using System;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Spatial.Prefix.Tree
{
diff --git a/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs b/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
index b26d87f03d..6005157b39 100644
--- a/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
+++ b/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
@@ -15,7 +15,6 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search.Spell
{
@@ -448,7 +447,7 @@ public void TestClose()
}
/*
- * tests if the internally shared indexsearcher is correctly closed
+ * tests if the internally shared indexsearcher is correctly closed
* when the spellchecker is concurrently accessed and closed.
*/
[Test]
@@ -490,7 +489,7 @@ public async Task TestConcurrentAccess()
Thread.Sleep(100);
// concurrently reset the spell index
spellChecker.SetSpellIndex(this.spellindex);
- // for debug - prints the internal open searchers
+ // for debug - prints the internal open searchers
// showSearchersOpen();
}
@@ -559,7 +558,7 @@ private void AssertSearchersClosed()
// for (IndexSearcher searcher : searchers) {
// if(searcher.getIndexReader().getRefCount() > 0)
// ++count;
- // }
+ // }
// System.out.println(count);
// }
@@ -578,7 +577,7 @@ public SpellCheckWorker(TestSpellChecker outerInstance, IndexReader reader, Atom
{
this.outerInstance = outerInstance;
this.reader = reader;
-
+
this.stop = stop;
this.cancellationToken = cancellationToken;
this.taskNum = taskNum;
@@ -611,7 +610,7 @@ public void Run()
}
catch (Exception e) when (e.IsThrowable())
{
- e.printStackTrace();
+ e.PrintStackTrace();
error = e;
return;
}
@@ -630,21 +629,6 @@ public void Run()
}
}
- ///
- /// Grab the stack trace into a string since the exception was thrown in a thread and we want the assert
- /// outside the thread to show the stack trace in case of failure.
- ///
- private string stackTraceStr(Exception error)
- {
- if (error is null)
- {
- return "";
- }
-
- error.printStackTrace();
- return error.StackTrace;
- }
-
internal class SpellCheckerMock : SpellChecker
{
public SpellCheckerMock(Directory spellIndex)
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs
index 88d333ab5c..00bb9a52fe 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs
@@ -16,7 +16,6 @@
using System.Text.RegularExpressions;
using System.Threading;
using static Lucene.Net.Search.Suggest.Lookup;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Search.Suggest.Analyzing
@@ -117,7 +116,7 @@ public void TestAfterLoad()
}
///
- /// Used to return highlighted result; see
+ /// Used to return highlighted result; see
///
///
private sealed class LookupHighlightFragment
@@ -445,7 +444,7 @@ public void TestSuggestStopFilter()
public void TestEmptyAtStart()
{
Analyzer a = new MockAnalyzer(Random, MockTokenizer.WHITESPACE, false);
- using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0
+ using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0
suggester.Build(new InputArrayEnumerator(new Input[0]));
suggester.Add(new BytesRef("a penny saved is a penny earned"), null, 10, new BytesRef("foobaz"));
suggester.Add(new BytesRef("lend me your ear"), null, 8, new BytesRef("foobar"));
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingSuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingSuggesterTest.cs
index 1d36a2196b..80847eae76 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingSuggesterTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingSuggesterTest.cs
@@ -12,7 +12,6 @@
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Search.Suggest.Analyzing
@@ -258,7 +257,7 @@ public void TestNoSeps()
suggester.Build(new InputArrayEnumerator(keys));
// TODO: would be nice if "ab " would allow the test to
// pass, and more generally if the analyzer can know
- // that the user's current query has ended at a word,
+ // that the user's current query has ended at a word,
// but, analyzers don't produce SEP tokens!
IList r = suggester.DoLookup(TestUtil.StringToCharSequence("ab c", Random).ToString(), false, 2);
assertEquals(2, r.size());
@@ -426,8 +425,8 @@ public void TestInputPathRequired()
// final SynonymMap map = b.build();
// The Analyzer below mimics the functionality of the SynonymAnalyzer
- // using the above map, so that the suggest module does not need a dependency on the
- // synonym module
+ // using the above map, so that the suggest module does not need a dependency on the
+ // synonym module
Analyzer analyzer = new TestInputPathRequiredAnalyzer(this);
@@ -465,11 +464,11 @@ private void printTokens(final Analyzer analyzer, String input) throws IOExcepti
while(ts.incrementToken()) {
termBytesAtt.fillBytesRef();
- System.out.println(String.format("%s,%s,%s", termBytesAtt.getBytesRef().utf8ToString(), posIncAtt.getPositionIncrement(), posLengthAtt.getPositionLength()));
+ System.out.println(String.format("%s,%s,%s", termBytesAtt.getBytesRef().utf8ToString(), posIncAtt.getPositionIncrement(), posLengthAtt.getPositionLength()));
}
ts.end();
ts.close();
- }
+ }
*/
internal class UsualTokenStreamComponents : TokenStreamComponents
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/BlendedInfixSuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/BlendedInfixSuggesterTest.cs
index e5e6541beb..b13c7166fb 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/BlendedInfixSuggesterTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/BlendedInfixSuggesterTest.cs
@@ -6,7 +6,6 @@
using System;
using System.Collections.Generic;
using System.IO;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search.Suggest.Analyzing
{
@@ -167,7 +166,7 @@ public void TestRequiresMore()
suggester.Dispose();
}
-
+
/**
* Handle trailing spaces that result in no prefix token LUCENE-6093
*/
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs
index d97602f1c4..840775a90f 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs
@@ -13,7 +13,6 @@
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Search.Suggest.Analyzing
@@ -210,7 +209,7 @@ public void TestNoSeps()
suggester.Build(new InputArrayEnumerator(keys));
// TODO: would be nice if "ab " would allow the test to
// pass, and more generally if the analyzer can know
- // that the user's current query has ended at a word,
+ // that the user's current query has ended at a word,
// but, analyzers don't produce SEP tokens!
IList r = suggester.DoLookup(TestUtil.StringToCharSequence("ab c", Random).ToString(), false, 2);
assertEquals(2, r.size());
@@ -386,8 +385,8 @@ public void TestInputPathRequired()
// final SynonymMap map = b.build();
// The Analyzer below mimics the functionality of the SynonymAnalyzer
- // using the above map, so that the suggest module does not need a dependency on the
- // synonym module
+ // using the above map, so that the suggest module does not need a dependency on the
+ // synonym module
Analyzer analyzer = new TestInputPathRequiredAnalyzer(this);
@@ -420,11 +419,11 @@ private void printTokens(final Analyzer analyzer, String input) throws IOExcepti
while(ts.incrementToken()) {
termBytesAtt.fillBytesRef();
- Console.WriteLine(String.format("%s,%s,%s", termBytesAtt.getBytesRef().utf8ToString(), posIncAtt.getPositionIncrement(), posLengthAtt.getPositionLength()));
+ Console.WriteLine(String.format("%s,%s,%s", termBytesAtt.getBytesRef().utf8ToString(), posIncAtt.getPositionIncrement(), posLengthAtt.getPositionLength()));
}
ts.end();
ts.close();
- }
+ }
*/
internal class UsualTokenStreamComponents : TokenStreamComponents
@@ -1334,10 +1333,10 @@ public int GetDistance(string target, string other, bool allowTransposition)
int n;
int[][] d; // cost array
- // NOTE: if we cared, we could 3*m space instead of m*n space, similar to
- // what LevenshteinDistance does, except cycling thru a ring of three
- // horizontal cost arrays... but this comparer is never actually used by
- // DirectSpellChecker, its only used for merging results from multiple shards
+ // NOTE: if we cared, we could 3*m space instead of m*n space, similar to
+ // what LevenshteinDistance does, except cycling thru a ring of three
+ // horizontal cost arrays... but this comparer is never actually used by
+ // DirectSpellChecker, its only used for merging results from multiple shards
// in "distributed spellcheck", and its inefficient in other ways too...
// cheaper to do this up front once
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
index 3919605563..782143267b 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
@@ -12,7 +12,6 @@
using System.Globalization;
using System.IO;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Search.Suggest.Analyzing
@@ -602,7 +601,7 @@ public void TestRandom()
//Integer count = model.get(ngram);
if (model.TryGetValue(ngram, out int count))
{
- // LUCENENET NOTE: We need to calculate this as decimal because when using double it can sometimes
+ // LUCENENET NOTE: We need to calculate this as decimal because when using double it can sometimes
// return numbers that are greater than long.MaxValue, which results in a negative long number.
// This is also the way it is being done in the FreeTextSuggester to work around the issue.
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs
index 9e6c80f3fb..f9c417d1ce 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs
@@ -7,7 +7,6 @@
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Search.Suggest.Fst
@@ -96,7 +95,7 @@ public void TestExactMatchLowPriority()
[Test]
public void TestExactMatchReordering()
{
- // Check reordering of exact matches.
+ // Check reordering of exact matches.
AssertMatchEquals(completion.DoLookup(StringToCharSequence("four").ToString(), 4),
"four/0.0",
"fourblah/1.0",
@@ -112,12 +111,12 @@ public void TestRequestedCount()
"one/0.0",
"oneness/1.0");
- // 'four' is collected in a bucket and then again as an exact match.
+ // 'four' is collected in a bucket and then again as an exact match.
AssertMatchEquals(completion.DoLookup(StringToCharSequence("four").ToString(), 2),
"four/0.0",
"fourblah/1.0");
- // Check reordering of exact matches.
+ // Check reordering of exact matches.
AssertMatchEquals(completion.DoLookup(StringToCharSequence("four").ToString(), 4),
"four/0.0",
"fourblah/1.0",
@@ -135,7 +134,7 @@ public void TestRequestedCount()
"oneness/1.0",
"onerous/1.0");
- // 'one' is at the top after collecting all alphabetical results.
+ // 'one' is at the top after collecting all alphabetical results.
AssertMatchEquals(completionAlphabetical.DoLookup(StringToCharSequence("one").ToString(), 2),
"one/0.0",
"oneness/1.0");
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/LargeInputFST.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/LargeInputFST.cs
index 19a6a45870..2ce82c67e5 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/LargeInputFST.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/LargeInputFST.cs
@@ -2,7 +2,6 @@
using System;
using System.IO;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search.Suggest.Fst
{
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs
index e4669f5e7e..8a2deb82ab 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs
@@ -17,7 +17,6 @@
using System.Linq;
using System.Reflection;
using System.Text;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Search.Suggest
@@ -165,7 +164,7 @@ public void TestStorageNeeds()
}
/**
- * Create instance and populate it.
+ * Create instance and populate it.
*/
internal Lookup BuildLookup(Type cls, Input[] input)
{
@@ -227,7 +226,7 @@ public void TestPerformanceOnPrefixes2_4()
}
/**
- * Run the actual benchmark.
+ * Run the actual benchmark.
*/
public void RunPerformanceTest(int minPrefixLen, int maxPrefixLen,
int num, bool onlyMorePopular)
@@ -290,7 +289,7 @@ public int Call()
*/
private BenchmarkResult Measure(Func callable)
{
- double NANOS_PER_MS = 1000000;
+ const double NANOS_PER_MS = 1000000;
try
{
@@ -305,9 +304,8 @@ private BenchmarkResult Measure(Func callable)
}
catch (Exception e) when (e.IsException())
{
- e.printStackTrace();
+ e.PrintStackTrace();
throw RuntimeException.Create(e);
-
}
}
diff --git a/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs b/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs
index 5f43e11d67..5858f89484 100644
--- a/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs
+++ b/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs
@@ -9,7 +9,6 @@
using System.Text;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Analysis
{
diff --git a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs
index 215046485d..c7d2694fb0 100644
--- a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs
+++ b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs
@@ -10,7 +10,6 @@
using System.Collections.Generic;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Codecs.Lucene3x
{
diff --git a/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat2.cs b/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat2.cs
index 3c8db26608..5bad7e0fad 100644
--- a/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat2.cs
+++ b/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat2.cs
@@ -13,7 +13,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using RandomizedTesting.Generators;
namespace Lucene.Net.Codecs.PerField
diff --git a/src/Lucene.Net.Tests/Index/Test2BBinaryDocValues.cs b/src/Lucene.Net.Tests/Index/Test2BBinaryDocValues.cs
index f253121445..a3b584a0df 100644
--- a/src/Lucene.Net.Tests/Index/Test2BBinaryDocValues.cs
+++ b/src/Lucene.Net.Tests/Index/Test2BBinaryDocValues.cs
@@ -4,7 +4,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/Test2BNumericDocValues.cs b/src/Lucene.Net.Tests/Index/Test2BNumericDocValues.cs
index 8f630f7b26..6c60627971 100644
--- a/src/Lucene.Net.Tests/Index/Test2BNumericDocValues.cs
+++ b/src/Lucene.Net.Tests/Index/Test2BNumericDocValues.cs
@@ -4,7 +4,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/Test2BPositions.cs b/src/Lucene.Net.Tests/Index/Test2BPositions.cs
index e714d9fdad..daf8c66150 100644
--- a/src/Lucene.Net.Tests/Index/Test2BPositions.cs
+++ b/src/Lucene.Net.Tests/Index/Test2BPositions.cs
@@ -4,7 +4,6 @@
using Lucene.Net.Store;
using NUnit.Framework;
using System;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/Test2BPostings.cs b/src/Lucene.Net.Tests/Index/Test2BPostings.cs
index 44ddbf4cdb..53c9983dc2 100644
--- a/src/Lucene.Net.Tests/Index/Test2BPostings.cs
+++ b/src/Lucene.Net.Tests/Index/Test2BPostings.cs
@@ -4,7 +4,6 @@
using Lucene.Net.Store;
using NUnit.Framework;
using System;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/Test2BSortedDocValues.cs b/src/Lucene.Net.Tests/Index/Test2BSortedDocValues.cs
index 113206f0a4..5114bd2648 100644
--- a/src/Lucene.Net.Tests/Index/Test2BSortedDocValues.cs
+++ b/src/Lucene.Net.Tests/Index/Test2BSortedDocValues.cs
@@ -4,7 +4,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/Test2BTerms.cs b/src/Lucene.Net.Tests/Index/Test2BTerms.cs
index aa32f51cc0..49226d0ab6 100644
--- a/src/Lucene.Net.Tests/Index/Test2BTerms.cs
+++ b/src/Lucene.Net.Tests/Index/Test2BTerms.cs
@@ -12,7 +12,6 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Index
diff --git a/src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs b/src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs
index 4539ef62a0..5639da8dec 100644
--- a/src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs
+++ b/src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs
@@ -5,7 +5,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using RandomInts = RandomizedTesting.Generators.RandomNumbers;
namespace Lucene.Net.Index
diff --git a/src/Lucene.Net.Tests/Index/TestAddIndexes.cs b/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
index fe49a296de..f5d9395910 100644
--- a/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
+++ b/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
@@ -10,7 +10,6 @@
using System.Linq;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Index
@@ -831,7 +830,7 @@ public CommitAndAddIndexes(int numCopy)
internal override void Handle(Exception t)
{
- t.printStackTrace(Console.Out);
+ t.PrintStackTrace(Console.Out);
UninterruptableMonitor.Enter(failures);
try
{
@@ -936,7 +935,7 @@ internal override void Handle(Exception t)
{
if (!t.IsAlreadyClosedException() && !t.IsNullPointerException())
{
- t.printStackTrace(Console.Out);
+ t.PrintStackTrace(Console.Out);
UninterruptableMonitor.Enter(failures);
try
{
@@ -1046,7 +1045,7 @@ internal override void Handle(Exception t)
}
if (report)
{
- t.printStackTrace(Console.Out);
+ t.PrintStackTrace(Console.Out);
UninterruptableMonitor.Enter(failures);
try
{
diff --git a/src/Lucene.Net.Tests/Index/TestAtomicUpdate.cs b/src/Lucene.Net.Tests/Index/TestAtomicUpdate.cs
index 48410fe188..284a758ca9 100644
--- a/src/Lucene.Net.Tests/Index/TestAtomicUpdate.cs
+++ b/src/Lucene.Net.Tests/Index/TestAtomicUpdate.cs
@@ -7,7 +7,6 @@
using System;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -68,7 +67,7 @@ public override void Run()
catch (Exception e) when (e.IsThrowable())
{
Console.WriteLine(Thread.CurrentThread.Name + ": exc");
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
failed = true;
}
}
diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
index 4989ce80ea..65fecf6be6 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
@@ -10,7 +10,6 @@
using System.Text;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -300,7 +299,7 @@ public virtual void TestUnsupportedOldIndexes()
if (Verbose)
{
Console.WriteLine("TEST: got expected exc:");
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
}
// Make sure exc message includes a path=
Assert.IsTrue(e.Message.IndexOf("path=\"", StringComparison.Ordinal) != -1, "got exc message: " + e.Message);
diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
index 336580ff9e..f46e28a544 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
@@ -9,7 +9,6 @@
using System.Text;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -231,7 +230,7 @@ public virtual void TestUnsupportedOldIndexes()
if (Verbose)
{
Console.WriteLine("TEST: got expected exc:");
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
}
// Make sure exc message includes a path=
Assert.IsTrue(e.Message.IndexOf("path=\"", StringComparison.Ordinal) != -1, "got exc message: " + e.Message);
diff --git a/src/Lucene.Net.Tests/Index/TestBagOfPositions.cs b/src/Lucene.Net.Tests/Index/TestBagOfPositions.cs
index b81ba92038..e0bf419794 100644
--- a/src/Lucene.Net.Tests/Index/TestBagOfPositions.cs
+++ b/src/Lucene.Net.Tests/Index/TestBagOfPositions.cs
@@ -12,7 +12,6 @@
using System.Threading;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestBagOfPostings.cs b/src/Lucene.Net.Tests/Index/TestBagOfPostings.cs
index 87b8324853..9cfb3b6551 100644
--- a/src/Lucene.Net.Tests/Index/TestBagOfPostings.cs
+++ b/src/Lucene.Net.Tests/Index/TestBagOfPostings.cs
@@ -10,7 +10,6 @@
using System.Text;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Index
diff --git a/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs b/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs
index 649943eccc..5ad4bc3d99 100644
--- a/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs
+++ b/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs
@@ -17,7 +17,6 @@
using System.IO;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Index
diff --git a/src/Lucene.Net.Tests/Index/TestByteSlices.cs b/src/Lucene.Net.Tests/Index/TestByteSlices.cs
index 429ca6d575..6c3fdf359f 100644
--- a/src/Lucene.Net.Tests/Index/TestByteSlices.cs
+++ b/src/Lucene.Net.Tests/Index/TestByteSlices.cs
@@ -1,7 +1,7 @@
using NUnit.Framework;
using RandomizedTesting.Generators;
+using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestCheckIndex.cs b/src/Lucene.Net.Tests/Index/TestCheckIndex.cs
index 443ea738c0..e9d58192f0 100644
--- a/src/Lucene.Net.Tests/Index/TestCheckIndex.cs
+++ b/src/Lucene.Net.Tests/Index/TestCheckIndex.cs
@@ -3,12 +3,12 @@
using Lucene.Net.Support.IO;
using Lucene.Net.Util;
using NUnit.Framework;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestCodecs.cs b/src/Lucene.Net.Tests/Index/TestCodecs.cs
index 411d878e5c..2402091ba6 100644
--- a/src/Lucene.Net.Tests/Index/TestCodecs.cs
+++ b/src/Lucene.Net.Tests/Index/TestCodecs.cs
@@ -10,7 +10,6 @@
using System.Collections.Generic;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Index
diff --git a/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs b/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs
index 9d3ded4b86..3cd7f43009 100644
--- a/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs
+++ b/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs
@@ -3,7 +3,6 @@
using Lucene.Net.Documents;
using Lucene.Net.Index.Extensions;
using Lucene.Net.Store;
-using Lucene.Net.Support.Threading;
using Lucene.Net.Util;
using NUnit.Framework;
using RandomizedTesting.Generators;
@@ -11,7 +10,6 @@
using System.IO;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -129,7 +127,7 @@ public virtual void TestFlushExceptions()
{
if (Verbose)
{
- Console.WriteLine(ioe.StackTrace);
+ ioe.PrintStackTrace(Console.Out);
}
failure.ClearDoFail();
break;
diff --git a/src/Lucene.Net.Tests/Index/TestCrash.cs b/src/Lucene.Net.Tests/Index/TestCrash.cs
index a6cc75918f..7b5153c363 100644
--- a/src/Lucene.Net.Tests/Index/TestCrash.cs
+++ b/src/Lucene.Net.Tests/Index/TestCrash.cs
@@ -3,7 +3,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs b/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs
index dbd97f2a9d..551bf6c3f2 100644
--- a/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs
+++ b/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs
@@ -1,9 +1,9 @@
using Lucene.Net.Documents;
+using Lucene.Net.Util;
using NUnit.Framework;
using System;
using System.IO;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -190,7 +190,7 @@ public override IndexOutput CreateOutput(string name, IOContext cxt)
if (Verbose)
{
Console.WriteLine("TEST: now crash");
- Console.WriteLine(new Exception().StackTrace);
+ StackTraceHelper.PrintCurrentStackTrace(Console.Out);
}
throw new CrashingException("crashAfterCreateOutput " + crashAfterCreateOutput);
}
diff --git a/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs b/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs
index 1916037e3b..3321b02c5f 100644
--- a/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs
+++ b/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs
@@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Index
diff --git a/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs b/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
index b9eac4c5bf..fb2354aa07 100644
--- a/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
@@ -9,7 +9,6 @@
using System.Threading;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestDirectoryReaderReopen.cs b/src/Lucene.Net.Tests/Index/TestDirectoryReaderReopen.cs
index fbc97cfde9..b949665e6e 100644
--- a/src/Lucene.Net.Tests/Index/TestDirectoryReaderReopen.cs
+++ b/src/Lucene.Net.Tests/Index/TestDirectoryReaderReopen.cs
@@ -8,7 +8,6 @@
using System.Text;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using Lucene.Net.Support.Threading;
namespace Lucene.Net.Index
@@ -506,7 +505,7 @@ public override void Run()
}
catch (Exception r) when (r.IsThrowable())
{
- Console.WriteLine(r.StackTrace);
+ r.PrintStackTrace(Console.Out);
this.error = r;
}
}
diff --git a/src/Lucene.Net.Tests/Index/TestDoc.cs b/src/Lucene.Net.Tests/Index/TestDoc.cs
index 7d2b8256d0..660863ea44 100644
--- a/src/Lucene.Net.Tests/Index/TestDoc.cs
+++ b/src/Lucene.Net.Tests/Index/TestDoc.cs
@@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.IO;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Index
diff --git a/src/Lucene.Net.Tests/Index/TestDocTermOrds.cs b/src/Lucene.Net.Tests/Index/TestDocTermOrds.cs
index 05d8a4d9f7..837a2f6aba 100644
--- a/src/Lucene.Net.Tests/Index/TestDocTermOrds.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocTermOrds.cs
@@ -6,7 +6,6 @@
using System;
using System.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Index
diff --git a/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs b/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs
index 3bb8736e83..cfbd9acd0c 100644
--- a/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs
@@ -8,7 +8,6 @@
using System.Threading;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using RandomizedTesting.Generators;
namespace Lucene.Net.Index
diff --git a/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs b/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs
index e59ac79119..3208a152e8 100644
--- a/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs
@@ -1,13 +1,11 @@
using J2N.Threading;
using J2N.Threading.Atomic;
-using Lucene.Net.Support.Threading;
using NUnit.Framework;
using RandomizedTesting.Generators;
using System;
using System.Collections.Generic;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -160,8 +158,7 @@ public virtual void TestAccquireReleaseRace()
{
foreach (Exception throwable in exceptions)
{
- Console.WriteLine(throwable.ToString());
- Console.Write(throwable.StackTrace);
+ throwable.PrintStackTrace();
}
Assert.Fail("got exceptions in threads");
}
@@ -283,8 +280,7 @@ public override void Run()
}
catch (Exception e) when (e.IsThrowable())
{
- Console.WriteLine(e.ToString());
- Console.Write(e.StackTrace);
+ e.PrintStackTrace();
exceptions.Add(e);
}
}
@@ -351,8 +347,7 @@ public override void Run()
}
catch (Exception e) when (e.IsThrowable())
{
- Console.WriteLine(e.ToString());
- Console.Write(e.StackTrace);
+ e.PrintStackTrace();
exceptions.Add(e);
}
diff --git a/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs b/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs
index ae61c4a7ec..98fe1b97fc 100644
--- a/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs
+++ b/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs
@@ -8,7 +8,6 @@
using System.Collections.Generic;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using Lucene.Net.Util;
namespace Lucene.Net.Index
@@ -379,7 +378,7 @@ public override void Run()
catch (Exception ex) when (ex.IsThrowable())
{
Console.WriteLine("FAILED exc:");
- ex.printStackTrace(Console.Out);
+ ex.PrintStackTrace(Console.Out);
throw RuntimeException.Create(ex);
}
}
diff --git a/src/Lucene.Net.Tests/Index/TestForceMergeForever.cs b/src/Lucene.Net.Tests/Index/TestForceMergeForever.cs
index 8703e2e1ad..74d75043bf 100644
--- a/src/Lucene.Net.Tests/Index/TestForceMergeForever.cs
+++ b/src/Lucene.Net.Tests/Index/TestForceMergeForever.cs
@@ -4,7 +4,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
index bda15ce0fe..2d0d2bc764 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
@@ -18,7 +18,6 @@
using System.IO;
using System.Text;
using System.Threading;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Index
@@ -1329,7 +1328,7 @@ public override void Run()
// Jenkins hits a fail we need to study where the
// interrupts struck!
Console.WriteLine("TEST: got interrupt");
- Console.WriteLine(GetToStringFrom(re));
+ Console.WriteLine(LockSafeGetToStringFrom(re));
Exception e = re.InnerException;
Assert.IsTrue(e is System.Threading.ThreadInterruptedException);
@@ -1356,7 +1355,7 @@ public override void Run()
catch (Exception t) when (t.IsThrowable())
{
Console.WriteLine("FAILED; unexpected exception");
- Console.WriteLine(GetToStringFrom(t));
+ Console.WriteLine(LockSafeGetToStringFrom(t));
failed = true;
break;
}
@@ -1406,7 +1405,7 @@ public override void Run()
{
failed = true;
Console.WriteLine("CheckIndex FAILED: unexpected exception");
- Console.WriteLine(e.ToString());
+ e.PrintStackTrace(Console.Out);
}
try
{
@@ -1417,7 +1416,7 @@ public override void Run()
{
failed = true;
Console.WriteLine("DirectoryReader.open FAILED: unexpected exception");
- Console.WriteLine(e.ToString());
+ e.PrintStackTrace(Console.Out);
}
}
try
@@ -1438,12 +1437,14 @@ public override void Run()
}
}
- // LUCENENET specific - since the lock statement can potentially throw System.Threading.ThreadInterruptedException in .NET,
- // we need to be vigilant about getting stack trace info from the errors during tests and retry if we get an interrupt exception.
///
/// Safely gets the ToString() of an exception while ignoring any System.Threading.ThreadInterruptedException and retrying.
///
- private static string GetToStringFrom(Exception exception)
+ ///
+ /// LUCENENET specific - since the lock statement can potentially throw System.Threading.ThreadInterruptedException in .NET,
+ /// we need to be vigilant about getting stack trace info from the errors during tests and retry if we get an interrupt exception.
+ ///
+ private static string LockSafeGetToStringFrom(Exception exception)
{
// Clear interrupt state:
try
@@ -1460,7 +1461,7 @@ private static string GetToStringFrom(Exception exception)
}
catch (Exception ie) when (ie.IsInterruptedException())
{
- return GetToStringFrom(exception);
+ return LockSafeGetToStringFrom(exception);
}
}
}
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterCommit.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterCommit.cs
index 2334859462..2b220d5af6 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterCommit.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterCommit.cs
@@ -8,7 +8,6 @@
using System;
using System.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
index 525750e988..197935fa9f 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
@@ -5,6 +5,7 @@
using Lucene.Net.Documents;
using Lucene.Net.Index.Extensions;
using Lucene.Net.Store;
+using Lucene.Net.Support;
using Lucene.Net.Support.IO;
using Lucene.Net.Util;
using NUnit.Framework;
@@ -15,7 +16,6 @@
using System.Text;
using System.Threading;
using JCG = J2N.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
// ReSharper disable once RedundantUsingDirective - keep until we have an analyzer to look out for accidental NUnit asserts
using Assert = Lucene.Net.TestFramework.Assert;
@@ -722,14 +722,13 @@ private void DoTestOperationsOnDiskFull(bool updates)
{
if (Verbose)
{
- Console.WriteLine(" hit IOException: " + e);
- Console.WriteLine(e.StackTrace);
+ Console.WriteLine(" hit IOException: " + e.ToTypeMessageString()); // LUCENENET specific: ToTypeMessageString() mimics Java behavior
+ e.PrintStackTrace(Console.Out);
}
err = e;
if (1 == x)
{
- Console.WriteLine(e.ToString());
- Console.Write(e.StackTrace);
+ e.PrintStackTrace();
Assert.Fail(testName + " hit IOException after disk space was freed up");
}
}
@@ -771,8 +770,7 @@ private void DoTestOperationsOnDiskFull(bool updates)
}
catch (Exception e) when (e.IsIOException())
{
- Console.WriteLine(e.ToString());
- Console.Write(e.StackTrace);
+ e.PrintStackTrace();
Assert.Fail(testName + ":exception when creating IndexReader after disk full during close: " + e);
}
@@ -784,8 +782,7 @@ private void DoTestOperationsOnDiskFull(bool updates)
}
catch (Exception e) when (e.IsIOException())
{
- Console.WriteLine(e.ToString());
- Console.Write(e.StackTrace);
+ e.PrintStackTrace();
Assert.Fail(testName + ": exception when searching: " + e);
}
int result2 = hits.Length;
@@ -812,8 +809,7 @@ private void DoTestOperationsOnDiskFull(bool updates)
// all docs:
if (result2 != START_COUNT && result2 != END_COUNT)
{
- Console.WriteLine(err.ToString());
- Console.Write(err.StackTrace);
+ err.PrintStackTrace();
Assert.Fail(testName + ": method did throw exception but hits.Length for search on term 'aaa' is " + result2 + " instead of expected " + START_COUNT + " or " + END_COUNT);
}
}
@@ -989,7 +985,7 @@ public override void Eval(MockDirectoryWrapper dir)
if (Verbose)
{
Console.WriteLine("TEST: mock failure: now fail");
- Console.WriteLine(Environment.StackTrace);
+ StackTraceHelper.PrintCurrentStackTrace(Console.Out);
}
throw new IOException("fail after applyDeletes");
}
@@ -1003,7 +999,7 @@ public override void Eval(MockDirectoryWrapper dir)
if (Verbose)
{
Console.WriteLine("TEST: mock failure: saw applyDeletes");
- Console.WriteLine(Environment.StackTrace);
+ StackTraceHelper.PrintCurrentStackTrace(Console.Out);
}
sawMaybe = true;
}
@@ -1048,7 +1044,7 @@ public virtual void TestErrorInDocsWriterAdd()
if (Verbose)
{
Console.WriteLine("TEST: got expected exc:");
- Console.WriteLine(io.StackTrace);
+ io.PrintStackTrace(Console.Out);
}
break;
}
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
index 93d7da5d89..e3b6f0064e 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
@@ -16,7 +16,6 @@
using System.IO;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Index
@@ -235,7 +234,7 @@ public override void Run()
if (Verbose)
{
Console.WriteLine(Thread.CurrentThread.Name + ": EXC: ");
- Console.WriteLine(re.StackTrace);
+ re.PrintStackTrace(Console.Out);
}
try
{
@@ -244,7 +243,7 @@ public override void Run()
catch (Exception ioe) when (ioe.IsIOException())
{
Console.WriteLine(Thread.CurrentThread.Name + ": unexpected exception1");
- Console.WriteLine(ioe.StackTrace);
+ ioe.PrintStackTrace(Console.Out);
failure = ioe;
break;
}
@@ -252,7 +251,7 @@ public override void Run()
catch (Exception t) when (t.IsThrowable())
{
Console.WriteLine(Thread.CurrentThread.Name + ": unexpected exception2");
- Console.WriteLine(t.StackTrace);
+ t.PrintStackTrace(Console.Out);
failure = t;
break;
}
@@ -269,7 +268,7 @@ public override void Run()
catch (Exception t) when (t.IsThrowable())
{
Console.WriteLine(Thread.CurrentThread.Name + ": unexpected exception3");
- Console.WriteLine(t.StackTrace);
+ t.PrintStackTrace(Console.Out);
failure = t;
break;
}
@@ -304,7 +303,7 @@ public void Apply(string name)
if (Verbose)
{
Console.WriteLine(Thread.CurrentThread.Name + ": NOW FAIL: " + name);
- Console.WriteLine(new Exception().StackTrace);
+ StackTraceHelper.PrintCurrentStackTrace(Console.Out);
}
throw new TestPoint1Exception(Thread.CurrentThread.Name + ": intentionally failing at " + name); // LUCENENET TODO: Need to change this to RuntimeException once we add a custom (or flagged) exception that is created by RuntimeException.Create
}
@@ -345,7 +344,7 @@ public virtual void TestRandomExceptions()
thread.Run();
if (thread.failure != null)
{
- Console.WriteLine(thread.failure.StackTrace);
+ thread.failure.PrintStackTrace(Console.Out);
Assert.Fail("thread " + thread.Name + ": hit unexpected failure");
}
@@ -362,7 +361,7 @@ public virtual void TestRandomExceptions()
catch (Exception t) when (t.IsThrowable())
{
Console.WriteLine("exception during close:");
- Console.WriteLine(t.StackTrace);
+ t.PrintStackTrace(Console.Out);
writer.Rollback();
}
@@ -421,7 +420,7 @@ public virtual void TestRandomExceptionsThreads()
catch (Exception t) when (t.IsThrowable())
{
Console.WriteLine("exception during close:");
- Console.WriteLine(t.StackTrace);
+ t.PrintStackTrace(Console.Out);
writer.Rollback();
}
@@ -789,7 +788,7 @@ public virtual void TestDocumentsWriterExceptions()
if (Verbose)
{
Console.WriteLine("TEST: hit expected exception");
- Console.WriteLine(ioe.StackTrace);
+ ioe.PrintStackTrace(Console.Out);
}
}
@@ -998,7 +997,7 @@ public override void Run()
try
{
Console.WriteLine(Thread.CurrentThread.Name + ": ERROR: hit unexpected exception");
- Console.WriteLine(t.StackTrace);
+ t.PrintStackTrace(Console.Out);
}
finally
{
@@ -1028,7 +1027,7 @@ public override void Eval(MockDirectoryWrapper dir)
if (Verbose)
{
Console.WriteLine("TEST: now throw exc:");
- Console.WriteLine(Environment.StackTrace);
+ StackTraceHelper.PrintCurrentStackTrace(Console.Out);
}
throw new IOException("now failing on purpose during sync");
}
@@ -1341,7 +1340,7 @@ public virtual void TestSegmentsChecksumError()
}
catch (Exception e) when (e.IsIOException())
{
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
Assert.Fail("segmentInfos failed to retry fallback to correct segments_N file");
}
reader!.Dispose(); // LUCENENET [!]: using null suppression to match Java behavior
@@ -1525,7 +1524,7 @@ public virtual void TestSimulatedCrashedWriter()
}
catch (Exception e) when (e.IsException())
{
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
Assert.Fail("writer failed to open on a crashed index");
}
@@ -2364,7 +2363,7 @@ public override void Eval(MockDirectoryWrapper dir)
if (Verbose)
{
Console.WriteLine("TEST: now fail; thread=" + Thread.CurrentThread.Name + " exc:");
- Console.WriteLine(new Exception().StackTrace);
+ StackTraceHelper.PrintCurrentStackTrace(Console.Out);
}
shouldFail.Value = false;
throw new FakeIOException();
@@ -2535,7 +2534,7 @@ public override void Eval(MockDirectoryWrapper dir)
if (Verbose)
{
Console.WriteLine("TEST: now fail; thread=" + Thread.CurrentThread.Name + " exc:");
- Console.WriteLine(new Exception().StackTrace);
+ StackTraceHelper.PrintCurrentStackTrace(Console.Out);
}
throw new FakeIOException();
}
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterForceMerge.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterForceMerge.cs
index c7999f3932..f91ee3b50d 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterForceMerge.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterForceMerge.cs
@@ -1,8 +1,8 @@
using Lucene.Net.Documents;
using Lucene.Net.Index.Extensions;
using NUnit.Framework;
+using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs
index bddcb786ea..9e42ce2a64 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs
@@ -10,7 +10,6 @@
using System.Threading;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -488,7 +487,7 @@ public override void Run()
}
catch (Exception e) when (e.IsThrowable())
{
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
failure.Add(e);
done = true;
break;
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs
index cf3269d1a7..d8ff8788cb 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs
@@ -7,7 +7,6 @@
using System.IO;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -66,16 +65,14 @@ public virtual void TestIsCurrentWithThreads()
bool failed = writerThread.failed != null;
if (failed)
{
- Console.WriteLine(writerThread.failed.ToString());
- Console.Write(writerThread.failed.StackTrace);
+ writerThread.failed.PrintStackTrace();
}
for (int i = 0; i < threads.Length; i++)
{
threads[i].Join();
if (threads[i].failed != null)
{
- Console.WriteLine(threads[i].failed.ToString());
- Console.Write(threads[i].failed.StackTrace);
+ threads[i].failed.PrintStackTrace();
failed = true;
}
}
@@ -253,4 +250,4 @@ public override void Run()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs
index b96cb71ca3..7bf7b0167d 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs
@@ -7,7 +7,6 @@
using System;
using System.IO;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -103,7 +102,7 @@ public virtual void TestAddDocumentOnDiskFull()
if (Verbose)
{
Console.WriteLine("TEST: exception on addDoc");
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
}
hitError = true;
}
@@ -133,7 +132,7 @@ public virtual void TestAddDocumentOnDiskFull()
if (Verbose)
{
Console.WriteLine("TEST: exception on close; retry w/ no disk space limit");
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
}
dir.MaxSizeInBytes = 0;
writer.Dispose();
@@ -427,12 +426,12 @@ public virtual void TestAddIndexOnDiskFull()
if (Verbose)
{
Console.WriteLine(" hit IOException: " + e);
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
}
if (1 == x)
{
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
Assert.Fail(methodName + " hit IOException after disk space was freed up");
}
}
@@ -457,7 +456,7 @@ public virtual void TestAddIndexOnDiskFull()
}
catch (Exception e) when (e.IsIOException())
{
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
Assert.Fail(testName + ": exception when creating IndexReader: " + e);
}
int result = reader.DocFreq(searchTerm);
@@ -474,7 +473,7 @@ public virtual void TestAddIndexOnDiskFull()
// all docs:
if (result != START_COUNT && result != END_COUNT)
{
- Console.WriteLine(err.StackTrace);
+ err.PrintStackTrace(Console.Out);
Assert.Fail(testName + ": method did throw exception but docFreq('aaa') is " + result + " instead of expected " + START_COUNT + " or " + END_COUNT);
}
}
@@ -486,7 +485,7 @@ public virtual void TestAddIndexOnDiskFull()
}
catch (Exception e) when (e.IsIOException())
{
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
Assert.Fail(testName + ": exception when searching: " + e);
}
int result2 = hits.Length;
@@ -503,7 +502,7 @@ public virtual void TestAddIndexOnDiskFull()
// all docs:
if (result2 != result)
{
- Console.WriteLine(err.StackTrace);
+ err.PrintStackTrace(Console.Out);
Assert.Fail(testName + ": method did throw exception but hits.Length for search on term 'aaa' is " + result2 + " instead of expected " + result);
}
}
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs
index b88f6e483e..37ecf0f946 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs
@@ -14,7 +14,6 @@
using System.Threading;
using BaseDirectoryWrapper = Lucene.Net.Store.BaseDirectoryWrapper;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -286,7 +285,7 @@ public override void Run()
}
catch (Exception e) when (e.IsIOException())
{
- Console.Error.WriteLine("Couldn't pipe from the forked process: " + e.ToString());
+ Console.Error.WriteLine("Couldn't pipe from the forked process: " + e.ToTypeMessageString()); // LUCENENET specific - use ToTypeMessageString to mimic Java behavior
}
}
}
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs
index 784d5435a3..1bc4147e84 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs
@@ -3,7 +3,6 @@
using NUnit.Framework;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using RandomizedTesting.Generators;
namespace Lucene.Net.Index
@@ -146,8 +145,7 @@ public virtual void Test()
if (Verbose)
{
Console.WriteLine("TEST: iter=" + iter + ": exception");
- Console.WriteLine(ioe.ToString());
- Console.Write(ioe.StackTrace);
+ ioe.PrintStackTrace();
}
if (w != null)
{
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
index ab7d4d11e0..0bed9be3eb 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
@@ -1,5 +1,6 @@
using Lucene.Net.Attributes;
using Lucene.Net.Search;
+using Lucene.Net.Support;
using Lucene.Net.Util;
#if FEATURE_INDEXWRITER_TESTS
using J2N.Threading;
@@ -17,7 +18,6 @@
using System.Collections.Generic;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
#endif
namespace Lucene.Net.Index
@@ -529,7 +529,7 @@ internal virtual void CloseDir()
internal virtual void Handle(Exception t)
{
- Console.WriteLine(t.StackTrace);
+ t.PrintStackTrace(Console.Out);
UninterruptableMonitor.Enter(failures);
try
{
@@ -1384,7 +1384,7 @@ public override void Eval(MockDirectoryWrapper dir)
if (Verbose)
{
Console.WriteLine("TEST: now fail; exc:");
- Console.WriteLine(new Exception().StackTrace);
+ StackTraceHelper.PrintCurrentStackTrace(Console.Out);
}
shouldFail.Value = false;
throw new FakeIOException();
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
index 3d3b9ef4fa..2a6b6f1247 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
@@ -11,7 +11,6 @@
using System.IO;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -102,10 +101,10 @@ public override void Run()
if (Verbose)
{
Console.WriteLine("TEST: expected exc:");
- Console.WriteLine(ioe.StackTrace);
+ ioe.PrintStackTrace(Console.Out);
}
- //System.out.println(Thread.currentThread().getName() + ": hit exc");
- //ioConsole.WriteLine(e.StackTrace);
+ //Console.WriteLine(Thread.CurrentThread.Name + ": hit exc");
+ //ioe.PrintStackTrace(Console.Out);
if (ioe.Message.StartsWith("fake disk full at", StringComparison.Ordinal) || ioe.Message.Equals("now failing on purpose", StringComparison.Ordinal))
{
diskFull = true;
@@ -129,7 +128,7 @@ public override void Run()
if (noErrors)
{
Console.WriteLine(Thread.CurrentThread.Name + ": ERROR: unexpected IOException:");
- Console.WriteLine(ioe.StackTrace);
+ ioe.PrintStackTrace(Console.Out);
error = ioe;
}
break;
@@ -137,11 +136,11 @@ public override void Run()
}
catch (Exception t) when (t.IsThrowable())
{
- //Console.WriteLine(t.StackTrace);
+ //t.PrintStackTrace(Console.Out);
if (noErrors)
{
Console.WriteLine(Thread.CurrentThread.Name + ": ERROR: unexpected Throwable:");
- Console.WriteLine(t.StackTrace);
+ t.PrintStackTrace(Console.Out);
error = t;
}
break;
@@ -626,7 +625,7 @@ public override void Run()
{
failed = true;
failure = e;
- Console.WriteLine(e.ToString());
+ failure.PrintStackTrace(Console.Out);
// return; // LUCENENET: redundant return
}
}
diff --git a/src/Lucene.Net.Tests/Index/TestIndexableField.cs b/src/Lucene.Net.Tests/Index/TestIndexableField.cs
index 5c178fd313..19f0aa3147 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexableField.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexableField.cs
@@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.IO;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
#if !FEATURE_RANDOM_NEXTINT64_NEXTSINGLE
using RandomizedTesting.Generators; // for Random.NextSingle extension method
diff --git a/src/Lucene.Net.Tests/Index/TestLongPostings.cs b/src/Lucene.Net.Tests/Index/TestLongPostings.cs
index 28b8355122..68512d662b 100644
--- a/src/Lucene.Net.Tests/Index/TestLongPostings.cs
+++ b/src/Lucene.Net.Tests/Index/TestLongPostings.cs
@@ -7,7 +7,6 @@
using System;
using System.IO;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestMixedCodecs.cs b/src/Lucene.Net.Tests/Index/TestMixedCodecs.cs
index d91116e8b4..c4b3e75748 100644
--- a/src/Lucene.Net.Tests/Index/TestMixedCodecs.cs
+++ b/src/Lucene.Net.Tests/Index/TestMixedCodecs.cs
@@ -5,7 +5,6 @@
using System.Collections.Generic;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using RandomizedTesting.Generators;
namespace Lucene.Net.Index
diff --git a/src/Lucene.Net.Tests/Index/TestMultiFields.cs b/src/Lucene.Net.Tests/Index/TestMultiFields.cs
index b69cf5226c..f005612247 100644
--- a/src/Lucene.Net.Tests/Index/TestMultiFields.cs
+++ b/src/Lucene.Net.Tests/Index/TestMultiFields.cs
@@ -7,8 +7,8 @@
using System.Collections.Generic;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using RandomizedTesting.Generators;
+using System;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs b/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs
index c0d93b747a..121f19e25d 100644
--- a/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs
+++ b/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs
@@ -4,7 +4,6 @@
using NUnit.Framework;
using System;
using System.Threading;
-using Console = Lucene.Net.Util.SystemConsole;
#if !FEATURE_RANDOM_NEXTINT64_NEXTSINGLE
using RandomizedTesting.Generators;
@@ -140,7 +139,7 @@ public override void Run()
}
catch (Exception ex) when (ex.IsThrowable())
{
- Console.WriteLine(ex.StackTrace);
+ ex.PrintStackTrace(Console.Out);
this.ex = ex;
run = false;
}
diff --git a/src/Lucene.Net.Tests/Index/TestNRTThreads.cs b/src/Lucene.Net.Tests/Index/TestNRTThreads.cs
index c842e542d9..72fa5a1792 100644
--- a/src/Lucene.Net.Tests/Index/TestNRTThreads.cs
+++ b/src/Lucene.Net.Tests/Index/TestNRTThreads.cs
@@ -1,10 +1,10 @@
using Lucene.Net.Diagnostics;
using NUnit.Framework;
using RandomizedTesting.Generators;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestNeverDelete.cs b/src/Lucene.Net.Tests/Index/TestNeverDelete.cs
index 1c8bbd61db..f762753d9b 100644
--- a/src/Lucene.Net.Tests/Index/TestNeverDelete.cs
+++ b/src/Lucene.Net.Tests/Index/TestNeverDelete.cs
@@ -8,7 +8,6 @@
using System.Threading;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestParallelReaderEmptyIndex.cs b/src/Lucene.Net.Tests/Index/TestParallelReaderEmptyIndex.cs
index 891b1aa691..d512508f5f 100644
--- a/src/Lucene.Net.Tests/Index/TestParallelReaderEmptyIndex.cs
+++ b/src/Lucene.Net.Tests/Index/TestParallelReaderEmptyIndex.cs
@@ -1,8 +1,8 @@
using Lucene.Net.Documents;
using Lucene.Net.Index.Extensions;
using NUnit.Framework;
+using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestPayloads.cs b/src/Lucene.Net.Tests/Index/TestPayloads.cs
index 1affe6ba57..4733a94bf1 100644
--- a/src/Lucene.Net.Tests/Index/TestPayloads.cs
+++ b/src/Lucene.Net.Tests/Index/TestPayloads.cs
@@ -557,7 +557,7 @@ public override void Run()
}
catch (Exception e) when (e.IsException())
{
- e.printStackTrace();
+ e.PrintStackTrace();
Assert.Fail(e.ToString());
}
}
diff --git a/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs b/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs
index e1b080690c..1d16e2cd97 100644
--- a/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs
+++ b/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs
@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
#if !FEATURE_RANDOM_NEXTINT64_NEXTSINGLE
diff --git a/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs b/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
index d16d03b697..bda1c2bade 100644
--- a/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
+++ b/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
@@ -8,7 +8,6 @@
using RandomizedTesting.Generators;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs b/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs
index 2f94be2a55..3f1cb9eeef 100644
--- a/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs
+++ b/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs
@@ -7,7 +7,6 @@
using System.Threading;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -206,7 +205,7 @@ public override void Run()
}
catch (Exception t) when (t.IsThrowable())
{
- Console.WriteLine(t.StackTrace);
+ t.PrintStackTrace(Console.Out);
Assert.Fail("addDocument failed");
}
if (i % 2 == 0)
diff --git a/src/Lucene.Net.Tests/Index/TestStressAdvance.cs b/src/Lucene.Net.Tests/Index/TestStressAdvance.cs
index 1b10714801..f74649d21e 100644
--- a/src/Lucene.Net.Tests/Index/TestStressAdvance.cs
+++ b/src/Lucene.Net.Tests/Index/TestStressAdvance.cs
@@ -5,7 +5,6 @@
using System;
using System.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Index
diff --git a/src/Lucene.Net.Tests/Index/TestStressIndexing.cs b/src/Lucene.Net.Tests/Index/TestStressIndexing.cs
index 253060403a..83738aea4a 100644
--- a/src/Lucene.Net.Tests/Index/TestStressIndexing.cs
+++ b/src/Lucene.Net.Tests/Index/TestStressIndexing.cs
@@ -8,7 +8,6 @@
using System;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -69,7 +68,7 @@ public override void Run()
catch (Exception e) when (e.IsThrowable())
{
Console.WriteLine(Thread.CurrentThread + ": exc");
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
failed = true;
}
}
diff --git a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
index 41e9818ff5..f84792def5 100644
--- a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
+++ b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
@@ -16,7 +16,6 @@
using System.Threading;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -1042,8 +1041,7 @@ public override void Run()
}
catch (Exception e) when (e.IsThrowable())
{
- Console.WriteLine(e.ToString());
- Console.Write(e.StackTrace);
+ e.PrintStackTrace();
Assert.Fail(e.ToString());
}
diff --git a/src/Lucene.Net.Tests/Index/TestStressNRT.cs b/src/Lucene.Net.Tests/Index/TestStressNRT.cs
index 5b46b6fd8f..6943ddafe3 100644
--- a/src/Lucene.Net.Tests/Index/TestStressNRT.cs
+++ b/src/Lucene.Net.Tests/Index/TestStressNRT.cs
@@ -12,7 +12,6 @@
using System.Globalization;
using System.Threading;
using JCG = J2N.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -419,7 +418,7 @@ public override void Run()
catch (Exception e) when (e.IsThrowable())
{
Console.WriteLine(Thread.CurrentThread.Name + ": FAILED: unexpected exception");
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
throw RuntimeException.Create(e);
}
}
@@ -546,7 +545,7 @@ public override void Run()
{
operations.Value = (int)-1L;
Console.WriteLine(Thread.CurrentThread.Name + ": FAILED: unexpected exception");
- Console.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
throw RuntimeException.Create(e);
}
}
diff --git a/src/Lucene.Net.Tests/Index/TestSumDocFreq.cs b/src/Lucene.Net.Tests/Index/TestSumDocFreq.cs
index 2e20add835..8ad9b44442 100644
--- a/src/Lucene.Net.Tests/Index/TestSumDocFreq.cs
+++ b/src/Lucene.Net.Tests/Index/TestSumDocFreq.cs
@@ -1,7 +1,7 @@
using Lucene.Net.Documents;
using NUnit.Framework;
+using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net.Tests/Index/TestTermdocPerf.cs b/src/Lucene.Net.Tests/Index/TestTermdocPerf.cs
index d5819e6909..781e9c276a 100644
--- a/src/Lucene.Net.Tests/Index/TestTermdocPerf.cs
+++ b/src/Lucene.Net.Tests/Index/TestTermdocPerf.cs
@@ -5,7 +5,6 @@
using NUnit.Framework;
using System;
using System.IO;
-using Console = Lucene.Net.Util.SystemConsole;
#if !FEATURE_RANDOM_NEXTINT64_NEXTSINGLE
using RandomizedTesting.Generators;
diff --git a/src/Lucene.Net.Tests/Index/TestTermsEnum.cs b/src/Lucene.Net.Tests/Index/TestTermsEnum.cs
index cc8ca18981..e1dfd4d7b9 100644
--- a/src/Lucene.Net.Tests/Index/TestTermsEnum.cs
+++ b/src/Lucene.Net.Tests/Index/TestTermsEnum.cs
@@ -8,7 +8,6 @@
using System;
using System.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Index
diff --git a/src/Lucene.Net.Tests/Index/TestThreadedForceMerge.cs b/src/Lucene.Net.Tests/Index/TestThreadedForceMerge.cs
index 56d4bdd323..e74cdebb89 100644
--- a/src/Lucene.Net.Tests/Index/TestThreadedForceMerge.cs
+++ b/src/Lucene.Net.Tests/Index/TestThreadedForceMerge.cs
@@ -5,7 +5,6 @@
using System;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -169,7 +168,7 @@ public override void Run()
{
outerInstance.SetFailed();
Console.WriteLine(Thread.CurrentThread.Name + ": hit exception");
- Console.WriteLine(t.StackTrace);
+ t.PrintStackTrace(Console.Out);
}
}
}
diff --git a/src/Lucene.Net.Tests/Index/TestTieredMergePolicy.cs b/src/Lucene.Net.Tests/Index/TestTieredMergePolicy.cs
index 17f39863e7..b07766c968 100644
--- a/src/Lucene.Net.Tests/Index/TestTieredMergePolicy.cs
+++ b/src/Lucene.Net.Tests/Index/TestTieredMergePolicy.cs
@@ -5,7 +5,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -276,4 +275,4 @@ public virtual void TestSetters()
// TODO: Add more checks for other non-double setters!
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net.Tests/Index/TestTransactions.cs b/src/Lucene.Net.Tests/Index/TestTransactions.cs
index 4ff4e42731..4a4e8ddb05 100644
--- a/src/Lucene.Net.Tests/Index/TestTransactions.cs
+++ b/src/Lucene.Net.Tests/Index/TestTransactions.cs
@@ -8,7 +8,6 @@
using System.IO;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
@@ -87,7 +86,7 @@ public override void Run()
catch (Exception e) when (e.IsThrowable())
{
Console.WriteLine(Thread.CurrentThread + ": exc");
- Console.Error.WriteLine(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
failed = true;
}
}
diff --git a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
index 8bc77f2d2a..7705718ef7 100644
--- a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
+++ b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
@@ -8,7 +8,6 @@
using System.IO;
using System.Text.RegularExpressions;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search.Payloads
{
diff --git a/src/Lucene.Net.Tests/Search/Spans/TestPayloadSpans.cs b/src/Lucene.Net.Tests/Search/Spans/TestPayloadSpans.cs
index 9d601c403d..277b9a4ae1 100644
--- a/src/Lucene.Net.Tests/Search/Spans/TestPayloadSpans.cs
+++ b/src/Lucene.Net.Tests/Search/Spans/TestPayloadSpans.cs
@@ -9,7 +9,6 @@
using System.IO;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search.Spans
{
diff --git a/src/Lucene.Net.Tests/Search/Spans/TestSpansAdvanced.cs b/src/Lucene.Net.Tests/Search/Spans/TestSpansAdvanced.cs
index 35635bf32c..982649bff3 100644
--- a/src/Lucene.Net.Tests/Search/Spans/TestSpansAdvanced.cs
+++ b/src/Lucene.Net.Tests/Search/Spans/TestSpansAdvanced.cs
@@ -3,7 +3,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search.Spans
{
diff --git a/src/Lucene.Net.Tests/Search/TestAutomatonQuery.cs b/src/Lucene.Net.Tests/Search/TestAutomatonQuery.cs
index c4d8652843..fb867687a2 100644
--- a/src/Lucene.Net.Tests/Search/TestAutomatonQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestAutomatonQuery.cs
@@ -1,9 +1,9 @@
using J2N.Threading;
using Lucene.Net.Documents;
using NUnit.Framework;
+using System;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestBoolean2.cs b/src/Lucene.Net.Tests/Search/TestBoolean2.cs
index 6f7b69d07d..6d54e4e9f0 100644
--- a/src/Lucene.Net.Tests/Search/TestBoolean2.cs
+++ b/src/Lucene.Net.Tests/Search/TestBoolean2.cs
@@ -5,7 +5,6 @@
using RandomizedTesting.Generators;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs b/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs
index 1c77c349b7..7b47ff9966 100644
--- a/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs
+++ b/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs
@@ -4,7 +4,6 @@
using NUnit.Framework;
using RandomizedTesting.Generators;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs b/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs
index 1a06b59f76..e51f633c8e 100644
--- a/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs
@@ -6,7 +6,6 @@
using System.Threading.Tasks;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs b/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
index e94b0da9f2..c66ca5e53a 100644
--- a/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
+++ b/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
@@ -17,7 +17,6 @@
using System.Threading.Tasks;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using Lucene.Net.Attributes;
namespace Lucene.Net.Search
@@ -475,7 +474,7 @@ public override void Run()
}
catch (Exception e) when (e.IsException())
{
- e.printStackTrace();
+ e.PrintStackTrace();
}
finally
{
diff --git a/src/Lucene.Net.Tests/Search/TestCustomSearcherSort.cs b/src/Lucene.Net.Tests/Search/TestCustomSearcherSort.cs
index c10f99745a..1c9d587865 100644
--- a/src/Lucene.Net.Tests/Search/TestCustomSearcherSort.cs
+++ b/src/Lucene.Net.Tests/Search/TestCustomSearcherSort.cs
@@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.Text;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Search
diff --git a/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs b/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs
index db7fb026e8..bb32b7acbf 100644
--- a/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs
@@ -4,7 +4,6 @@
using Lucene.Net.Index.Extensions;
using NUnit.Framework;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestDocBoost.cs b/src/Lucene.Net.Tests/Search/TestDocBoost.cs
index cbef0616c6..5c9a8179db 100644
--- a/src/Lucene.Net.Tests/Search/TestDocBoost.cs
+++ b/src/Lucene.Net.Tests/Search/TestDocBoost.cs
@@ -1,8 +1,8 @@
using Lucene.Net.Documents;
using Lucene.Net.Index.Extensions;
using NUnit.Framework;
+using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestDocIdSet.cs b/src/Lucene.Net.Tests/Search/TestDocIdSet.cs
index 57b8f1262e..3387c79513 100644
--- a/src/Lucene.Net.Tests/Search/TestDocIdSet.cs
+++ b/src/Lucene.Net.Tests/Search/TestDocIdSet.cs
@@ -5,7 +5,6 @@
using System.Collections.Generic;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestDocTermOrdsRangeFilter.cs b/src/Lucene.Net.Tests/Search/TestDocTermOrdsRangeFilter.cs
index d59a1bc54c..2a8e9f1e77 100644
--- a/src/Lucene.Net.Tests/Search/TestDocTermOrdsRangeFilter.cs
+++ b/src/Lucene.Net.Tests/Search/TestDocTermOrdsRangeFilter.cs
@@ -4,7 +4,6 @@
using RandomizedTesting.Generators;
using System;
using JCG = J2N.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestDocTermOrdsRewriteMethod.cs b/src/Lucene.Net.Tests/Search/TestDocTermOrdsRewriteMethod.cs
index 4bd5265719..b8b7a2ab86 100644
--- a/src/Lucene.Net.Tests/Search/TestDocTermOrdsRewriteMethod.cs
+++ b/src/Lucene.Net.Tests/Search/TestDocTermOrdsRewriteMethod.cs
@@ -6,7 +6,6 @@
using System;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestFieldCache.cs b/src/Lucene.Net.Tests/Search/TestFieldCache.cs
index 390daa7e54..60c515e804 100644
--- a/src/Lucene.Net.Tests/Search/TestFieldCache.cs
+++ b/src/Lucene.Net.Tests/Search/TestFieldCache.cs
@@ -13,7 +13,6 @@
using System.Text;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Search
diff --git a/src/Lucene.Net.Tests/Search/TestLiveFieldValues.cs b/src/Lucene.Net.Tests/Search/TestLiveFieldValues.cs
index 3c085e967c..5cb694a890 100644
--- a/src/Lucene.Net.Tests/Search/TestLiveFieldValues.cs
+++ b/src/Lucene.Net.Tests/Search/TestLiveFieldValues.cs
@@ -8,7 +8,6 @@
using System.Threading;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
#if !FEATURE_RANDOM_NEXTINT64_NEXTSINGLE
using RandomizedTesting.Generators;
diff --git a/src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs b/src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs
index 135462d8b5..5c4cf34a30 100644
--- a/src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs
@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs b/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs
index 3e20bf19ad..eb790a3615 100644
--- a/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs
+++ b/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs
@@ -3,7 +3,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs b/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
index d4ea426f1f..a1f887cab4 100644
--- a/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
+++ b/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
@@ -2,7 +2,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs b/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs
index 0d06ec9d6a..2c685d2df2 100644
--- a/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs
+++ b/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs
@@ -6,7 +6,6 @@
using System;
using System.Text;
using System.Threading;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
@@ -101,8 +100,7 @@ public virtual void Test()
}
catch (Exception ioe) when (ioe.IsIOException())
{
- Console.WriteLine(ioe.ToString());
- Console.Write(ioe.StackTrace);
+ ioe.PrintStackTrace();
}
}
}
@@ -187,7 +185,7 @@ public void Run()
}
catch (Exception e) when (e.IsException())
{
- e.printStackTrace();
+ e.PrintStackTrace();
}
return;
}
diff --git a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs
index 326054aa12..0a2f67cd6a 100644
--- a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs
+++ b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs
@@ -4,7 +4,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs
index 23b51420e1..f2ea0d5179 100644
--- a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs
+++ b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs
@@ -4,7 +4,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestPositionIncrement.cs b/src/Lucene.Net.Tests/Search/TestPositionIncrement.cs
index f1c3207e24..030215fb42 100644
--- a/src/Lucene.Net.Tests/Search/TestPositionIncrement.cs
+++ b/src/Lucene.Net.Tests/Search/TestPositionIncrement.cs
@@ -6,7 +6,6 @@
using System.IO;
using System.Text;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs b/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs
index 7730df0664..030e1eb37b 100644
--- a/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs
+++ b/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs
@@ -5,7 +5,6 @@
using RandomizedTesting.Generators;
using System;
using JCG = J2N.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestScorerPerf.cs b/src/Lucene.Net.Tests/Search/TestScorerPerf.cs
index 15ae8cce01..291a58206e 100644
--- a/src/Lucene.Net.Tests/Search/TestScorerPerf.cs
+++ b/src/Lucene.Net.Tests/Search/TestScorerPerf.cs
@@ -4,7 +4,6 @@
using System;
using Assert = Lucene.Net.TestFramework.Assert;
using BitSet = J2N.Collections.BitSet;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestSearchAfter.cs b/src/Lucene.Net.Tests/Search/TestSearchAfter.cs
index 0df57a5e75..cb9b3c2054 100644
--- a/src/Lucene.Net.Tests/Search/TestSearchAfter.cs
+++ b/src/Lucene.Net.Tests/Search/TestSearchAfter.cs
@@ -7,7 +7,6 @@
using System.Globalization;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestSearchWithThreads.cs b/src/Lucene.Net.Tests/Search/TestSearchWithThreads.cs
index e2b924cc07..a05e4758d8 100644
--- a/src/Lucene.Net.Tests/Search/TestSearchWithThreads.cs
+++ b/src/Lucene.Net.Tests/Search/TestSearchWithThreads.cs
@@ -6,7 +6,6 @@
using System;
using System.Text;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestSearcherManager.cs b/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
index 5e2fe78eb3..c0e4543dc4 100644
--- a/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
+++ b/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
@@ -10,7 +10,6 @@
using System.Threading;
using System.Threading.Tasks;
using JCG = J2N.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
@@ -173,9 +172,10 @@ public override void Run()
if (Verbose)
{
Console.WriteLine("TEST: reopen thread hit exc");
- Console.Out.Write(t.StackTrace);
+ t.PrintStackTrace(Console.Out);
}
- outerInstance.m_failed.Value = (true);
+
+ outerInstance.m_failed.Value = true;
throw RuntimeException.Create(t);
}
}
@@ -400,7 +400,7 @@ public void Run()
if (Verbose)
{
Console.WriteLine("FAIL: unexpected exc");
- Console.Out.Write(e.StackTrace);
+ e.PrintStackTrace(Console.Out);
}
exc[0] = e;
// use success as the barrier here to make sure we see the write
diff --git a/src/Lucene.Net.Tests/Search/TestShardSearching.cs b/src/Lucene.Net.Tests/Search/TestShardSearching.cs
index 219aba5efd..77520b553f 100644
--- a/src/Lucene.Net.Tests/Search/TestShardSearching.cs
+++ b/src/Lucene.Net.Tests/Search/TestShardSearching.cs
@@ -1,9 +1,9 @@
using J2N.Collections.Generic.Extensions;
using NUnit.Framework;
using RandomizedTesting.Generators;
+using System;
using System.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Search
@@ -294,7 +294,7 @@ public virtual void TestSimple()
if (Verbose)
{
Console.WriteLine(" searcher expired during search: " + see);
- Console.Out.Write(see.StackTrace);
+ see.PrintStackTrace(Console.Out);
}
// We can't do this in general: on a very slow
// computer it's possible the local searcher
diff --git a/src/Lucene.Net.Tests/Search/TestSortRandom.cs b/src/Lucene.Net.Tests/Search/TestSortRandom.cs
index 973d7e85e6..632b902711 100644
--- a/src/Lucene.Net.Tests/Search/TestSortRandom.cs
+++ b/src/Lucene.Net.Tests/Search/TestSortRandom.cs
@@ -6,7 +6,6 @@
using System.Linq;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using RandomizedTesting.Generators;
namespace Lucene.Net.Search
diff --git a/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs b/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs
index 20fa9066ac..72f06a5180 100644
--- a/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs
+++ b/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs
@@ -11,7 +11,6 @@
using NUnit.Framework;
using System;
using System.Text.RegularExpressions;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
@@ -158,7 +157,7 @@ private void DoTestSearch()
}
catch (Exception e) when (e.IsException())
{
- e.printStackTrace();
+ e.PrintStackTrace();
assertTrue("Unexpected exception: " + e, false); //==fail
}
assertEquals("Wrong number of results!", totalResults, totalTLCResults);
diff --git a/src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs b/src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs
index f492ce6101..1925cc088e 100644
--- a/src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs
+++ b/src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs
@@ -7,7 +7,6 @@
using System.Text;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestWildcard.cs b/src/Lucene.Net.Tests/Search/TestWildcard.cs
index b0d9762d9e..c8ef04ec94 100644
--- a/src/Lucene.Net.Tests/Search/TestWildcard.cs
+++ b/src/Lucene.Net.Tests/Search/TestWildcard.cs
@@ -1,8 +1,8 @@
using Lucene.Net.Documents;
using Lucene.Net.Index.Extensions;
using NUnit.Framework;
+using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Search/TestWildcardRandom.cs b/src/Lucene.Net.Tests/Search/TestWildcardRandom.cs
index 61d7b552df..5d90304876 100644
--- a/src/Lucene.Net.Tests/Search/TestWildcardRandom.cs
+++ b/src/Lucene.Net.Tests/Search/TestWildcardRandom.cs
@@ -1,9 +1,9 @@
using Lucene.Net.Documents;
using Lucene.Net.Index.Extensions;
using NUnit.Framework;
+using System;
using System.Text;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Search
{
diff --git a/src/Lucene.Net.Tests/Store/TestCopyBytes.cs b/src/Lucene.Net.Tests/Store/TestCopyBytes.cs
index 4ff093a951..1520cf05fa 100644
--- a/src/Lucene.Net.Tests/Store/TestCopyBytes.cs
+++ b/src/Lucene.Net.Tests/Store/TestCopyBytes.cs
@@ -4,7 +4,6 @@
using RandomizedTesting.Generators;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Store
{
diff --git a/src/Lucene.Net.Tests/Store/TestDirectory.cs b/src/Lucene.Net.Tests/Store/TestDirectory.cs
index e74fffbdf1..0a10ec1b7b 100644
--- a/src/Lucene.Net.Tests/Store/TestDirectory.cs
+++ b/src/Lucene.Net.Tests/Store/TestDirectory.cs
@@ -10,7 +10,6 @@
using System.Threading;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Store
{
diff --git a/src/Lucene.Net.Tests/Store/TestLockFactory.cs b/src/Lucene.Net.Tests/Store/TestLockFactory.cs
index 70d8c1d554..36e1a22610 100644
--- a/src/Lucene.Net.Tests/Store/TestLockFactory.cs
+++ b/src/Lucene.Net.Tests/Store/TestLockFactory.cs
@@ -7,7 +7,6 @@
using System.IO;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Store
{
@@ -100,7 +99,7 @@ public virtual void TestRAMDirectoryNoLocking()
}
catch (Exception e) when (e.IsException())
{
- e.printStackTrace();
+ e.PrintStackTrace(Console.Out);
Assert.Fail("Should not have hit an IOException with no locking");
}
@@ -316,8 +315,8 @@ public override void Run()
if (e.ToString().IndexOf(" timed out:", StringComparison.Ordinal) == -1)
{
HitException = true;
- Console.WriteLine("Stress Test Index Writer: creation hit unexpected IOException: " + e.ToString());
- Console.Out.Write(e.StackTrace);
+ Console.WriteLine("Stress Test Index Writer: creation hit unexpected IOException: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior
+ e.PrintStackTrace(Console.Out);
}
else
{
@@ -332,8 +331,8 @@ public override void Run()
catch (Exception e) when (e.IsException())
{
HitException = true;
- Console.WriteLine("Stress Test Index Writer: creation hit unexpected exception: " + e.ToString());
- e.printStackTrace(Console.Out);
+ Console.WriteLine("Stress Test Index Writer: creation hit unexpected exception: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior
+ e.PrintStackTrace(Console.Out);
break;
}
if (writer != null)
@@ -345,8 +344,8 @@ public override void Run()
catch (Exception e) when (e.IsIOException())
{
HitException = true;
- Console.WriteLine("Stress Test Index Writer: addDoc hit unexpected exception: " + e.ToString());
- Console.Out.Write(e.StackTrace);
+ Console.WriteLine("Stress Test Index Writer: addDoc hit unexpected exception: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior
+ e.PrintStackTrace(Console.Out);
break;
}
try
@@ -356,8 +355,8 @@ public override void Run()
catch (Exception e) when (e.IsIOException())
{
HitException = true;
- Console.WriteLine("Stress Test Index Writer: close hit unexpected exception: " + e.ToString());
- Console.Out.Write(e.StackTrace);
+ Console.WriteLine("Stress Test Index Writer: close hit unexpected exception: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior
+ e.PrintStackTrace(Console.Out);
break;
}
writer = null;
@@ -393,8 +392,8 @@ public override void Run()
catch (Exception e) when (e.IsException())
{
HitException = true;
- Console.WriteLine("Stress Test Index Searcher: create hit unexpected exception: " + e.ToString());
- e.printStackTrace(Console.Out);
+ Console.WriteLine("Stress Test Index Searcher: create hit unexpected exception: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior
+ e.PrintStackTrace(Console.Out);
break;
}
try
@@ -404,8 +403,8 @@ public override void Run()
catch (Exception e) when (e.IsIOException())
{
HitException = true;
- Console.WriteLine("Stress Test Index Searcher: search hit unexpected exception: " + e.ToString());
- Console.Out.Write(e.StackTrace);
+ Console.WriteLine("Stress Test Index Searcher: search hit unexpected exception: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior
+ e.PrintStackTrace(Console.Out);
break;
}
// System.out.println(hits.Length() + " total results");
@@ -416,8 +415,8 @@ public override void Run()
catch (Exception e) when (e.IsIOException())
{
HitException = true;
- Console.WriteLine("Stress Test Index Searcher: close hit unexpected exception: " + e.ToString());
- Console.Out.Write(e.StackTrace);
+ Console.WriteLine("Stress Test Index Searcher: close hit unexpected exception: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior
+ e.PrintStackTrace(Console.Out);
break;
}
}
diff --git a/src/Lucene.Net.Tests/Store/TestNRTCachingDirectory.cs b/src/Lucene.Net.Tests/Store/TestNRTCachingDirectory.cs
index 8e097ef569..c25c3d5999 100644
--- a/src/Lucene.Net.Tests/Store/TestNRTCachingDirectory.cs
+++ b/src/Lucene.Net.Tests/Store/TestNRTCachingDirectory.cs
@@ -4,7 +4,6 @@
using System.IO;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using Lucene.Net.Attributes;
namespace Lucene.Net.Store
diff --git a/src/Lucene.Net.Tests/Support/Text/TestStringExtensions.cs b/src/Lucene.Net.Tests/Support/Text/TestStringExtensions.cs
new file mode 100644
index 0000000000..b041d86ad6
--- /dev/null
+++ b/src/Lucene.Net.Tests/Support/Text/TestStringExtensions.cs
@@ -0,0 +1,48 @@
+using Lucene.Net.Attributes;
+using Lucene.Net.Util;
+using NUnit.Framework;
+#if !FEATURE_STRING_CONTAINS_STRINGCOMPARISON
+using System;
+#endif
+
+namespace Lucene.Net.Support.Text
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ [TestFixture, LuceneNetSpecific]
+ public class TestStringExtensions : LuceneTestCase
+ {
+ [Test]
+ public void TestContainsAny()
+ {
+ Assert.IsTrue("hello".ContainsAny(new[] { 'h', 'e', 'l', 'o' }));
+ Assert.IsFalse("hello".ContainsAny(new[] { 'x', 'y', 'z' }));
+ }
+
+#if !FEATURE_STRING_CONTAINS_STRINGCOMPARISON
+ [Test]
+ public void TestContainsWithStringComparison()
+ {
+ Assert.IsTrue("hello".Contains("ell", StringComparison.Ordinal));
+ Assert.IsFalse("hello".Contains("world", StringComparison.Ordinal));
+ Assert.IsTrue("hello".Contains("ELL", StringComparison.OrdinalIgnoreCase));
+ Assert.IsFalse("hello".Contains("WORLD", StringComparison.OrdinalIgnoreCase));
+ }
+#endif
+ }
+}
diff --git a/src/Lucene.Net.Tests/Support/Threading/JSR166TestCase.cs b/src/Lucene.Net.Tests/Support/Threading/JSR166TestCase.cs
index bdd1362944..990b2cd357 100644
--- a/src/Lucene.Net.Tests/Support/Threading/JSR166TestCase.cs
+++ b/src/Lucene.Net.Tests/Support/Threading/JSR166TestCase.cs
@@ -322,7 +322,7 @@ public void threadUnexpectedException()
public void threadUnexpectedException(Exception ex)
{
threadFailed = true;
- ex.printStackTrace();
+ ex.PrintStackTrace();
fail("Unexpected exception: " + ex);
}
diff --git a/src/Lucene.Net.Tests/Support/Threading/ReentrantLockTest.cs b/src/Lucene.Net.Tests/Support/Threading/ReentrantLockTest.cs
index 21bc3f56fc..5ba0faf677 100644
--- a/src/Lucene.Net.Tests/Support/Threading/ReentrantLockTest.cs
+++ b/src/Lucene.Net.Tests/Support/Threading/ReentrantLockTest.cs
@@ -11,7 +11,6 @@
using System.Threading;
using System.Threading.Tasks;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Support.Threading
{
diff --git a/src/Lucene.Net.Tests/Support/Util/Events/TestPubSubEvent.cs b/src/Lucene.Net.Tests/Support/Util/Events/TestPubSubEvent.cs
index c838b7d097..19a7f0d8ba 100644
--- a/src/Lucene.Net.Tests/Support/Util/Events/TestPubSubEvent.cs
+++ b/src/Lucene.Net.Tests/Support/Util/Events/TestPubSubEvent.cs
@@ -436,7 +436,7 @@ public async Task ShouldNotExecuteOnGarbageCollectedFilterReferenceWhenNotKeepAl
}
[Test]
- [Ignore("This test has been flakey since it was brought over from Prism")]
+ [Ignore("This test has been flakey since it was brought over from Prism (see https://github.com/apache/lucenenet/issues/998#issuecomment-2438994483)")]
public void CanAddSubscriptionWhileEventIsFiring()
{
var PubSubEvent = new TestablePubSubEvent();
@@ -459,6 +459,7 @@ public void CanAddSubscriptionWhileEventIsFiring()
}
[Test]
+ [Ignore("This test has been flakey since it was brought over from Prism (see https://github.com/apache/lucenenet/issues/998#issuecomment-2438994483)")]
public void CanAddSubscriptionWhileEventIsFiringNonGeneric()
{
var pubSubEvent = new TestablePubSubEvent();
@@ -710,4 +711,4 @@ public bool FilterString(string arg)
}
}
-#endif
\ No newline at end of file
+#endif
diff --git a/src/Lucene.Net.Tests/TestExternalCodecs.cs b/src/Lucene.Net.Tests/TestExternalCodecs.cs
index 5411d25b1c..65070115f5 100644
--- a/src/Lucene.Net.Tests/TestExternalCodecs.cs
+++ b/src/Lucene.Net.Tests/TestExternalCodecs.cs
@@ -2,7 +2,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net
{
diff --git a/src/Lucene.Net.Tests/TestMergeSchedulerExternal.cs b/src/Lucene.Net.Tests/TestMergeSchedulerExternal.cs
index 4d57032373..2763020442 100644
--- a/src/Lucene.Net.Tests/TestMergeSchedulerExternal.cs
+++ b/src/Lucene.Net.Tests/TestMergeSchedulerExternal.cs
@@ -7,7 +7,6 @@
using System.IO;
using System.Threading;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net
{
diff --git a/src/Lucene.Net.Tests/TestSearch.cs b/src/Lucene.Net.Tests/TestSearch.cs
index c3e0960f20..8d496aa939 100644
--- a/src/Lucene.Net.Tests/TestSearch.cs
+++ b/src/Lucene.Net.Tests/TestSearch.cs
@@ -9,7 +9,6 @@
using System.Collections.Generic;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using Occur = Lucene.Net.Search.Occur;
using StringWriter = System.IO.StringWriter;
diff --git a/src/Lucene.Net.Tests/TestSearchForDuplicates.cs b/src/Lucene.Net.Tests/TestSearchForDuplicates.cs
index 43d713bb3f..151740a9f4 100644
--- a/src/Lucene.Net.Tests/TestSearchForDuplicates.cs
+++ b/src/Lucene.Net.Tests/TestSearchForDuplicates.cs
@@ -7,7 +7,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using StringWriter = System.IO.StringWriter;
using TextWriter = System.IO.TextWriter;
diff --git a/src/Lucene.Net.Tests/TestWorstCaseTestBehavior.cs b/src/Lucene.Net.Tests/TestWorstCaseTestBehavior.cs
index f55400011b..1f6fab49ff 100644
--- a/src/Lucene.Net.Tests/TestWorstCaseTestBehavior.cs
+++ b/src/Lucene.Net.Tests/TestWorstCaseTestBehavior.cs
@@ -3,7 +3,6 @@
using NUnit.Framework;
using System;
using System.Threading;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net
{
diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs b/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs
index 9879c64749..4dd5179f18 100644
--- a/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs
+++ b/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs
@@ -3,7 +3,6 @@
using System.Collections.Generic;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using RandomInts = RandomizedTesting.Generators.RandomNumbers;
namespace Lucene.Net.Util.Automaton
diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestCompiledAutomaton.cs b/src/Lucene.Net.Tests/Util/Automaton/TestCompiledAutomaton.cs
index f882b146af..d02437e67e 100644
--- a/src/Lucene.Net.Tests/Util/Automaton/TestCompiledAutomaton.cs
+++ b/src/Lucene.Net.Tests/Util/Automaton/TestCompiledAutomaton.cs
@@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Util.Automaton
diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs b/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs
index 42e7125b24..ef2fa03e7e 100644
--- a/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs
+++ b/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs
@@ -6,7 +6,6 @@
using System;
using System.Text;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Util.Automaton
{
diff --git a/src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs b/src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs
index ff321b8367..69dab53413 100644
--- a/src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs
+++ b/src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs
@@ -2,7 +2,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using Int64 = J2N.Numerics.Int64;
#if !FEATURE_RANDOM_NEXTINT64_NEXTSINGLE
diff --git a/src/Lucene.Net.Tests/Util/Fst/TestBytesStore.cs b/src/Lucene.Net.Tests/Util/Fst/TestBytesStore.cs
index 3f0bc46638..9d90aaba3d 100644
--- a/src/Lucene.Net.Tests/Util/Fst/TestBytesStore.cs
+++ b/src/Lucene.Net.Tests/Util/Fst/TestBytesStore.cs
@@ -3,7 +3,6 @@
using RandomizedTesting.Generators;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Util.Fst
{
diff --git a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
index f8b1b89a18..55465090b3 100644
--- a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
+++ b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
@@ -12,7 +12,6 @@
using System.IO;
using System.Text;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
using Int64 = J2N.Numerics.Int64;
diff --git a/src/Lucene.Net.Tests/Util/Packed/TestPackedInts.cs b/src/Lucene.Net.Tests/Util/Packed/TestPackedInts.cs
index 3b2e89ec11..2009f8f164 100644
--- a/src/Lucene.Net.Tests/Util/Packed/TestPackedInts.cs
+++ b/src/Lucene.Net.Tests/Util/Packed/TestPackedInts.cs
@@ -6,7 +6,6 @@
using System.Collections.Generic;
using System.Globalization;
using JCG = J2N.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
using RandomInts = RandomizedTesting.Generators.RandomNumbers;
namespace Lucene.Net.Util.Packed
@@ -382,7 +381,7 @@ private static void AssertRandomEquality(int valueCount, int bitsPerValue, long
}
catch (Exception e) when (e.IsException())
{
- e.printStackTrace(Console.Error);
+ e.PrintStackTrace(Console.Error);
Assert.Fail(string.Format(CultureInfo.InvariantCulture, "Exception while filling {0}: valueCount={1}, bitsPerValue={2}", packedInt.GetType().Name, valueCount, bitsPerValue));
}
}
diff --git a/src/Lucene.Net.Tests/Util/StressRamUsageEstimator.cs b/src/Lucene.Net.Tests/Util/StressRamUsageEstimator.cs
index 523ff68936..661955812d 100644
--- a/src/Lucene.Net.Tests/Util/StressRamUsageEstimator.cs
+++ b/src/Lucene.Net.Tests/Util/StressRamUsageEstimator.cs
@@ -2,7 +2,6 @@
using NUnit.Framework;
using System;
using System.Globalization;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Util
{
diff --git a/src/Lucene.Net.Tests/Util/TestArrayUtil.cs b/src/Lucene.Net.Tests/Util/TestArrayUtil.cs
index 12945998b8..16e5819ed6 100644
--- a/src/Lucene.Net.Tests/Util/TestArrayUtil.cs
+++ b/src/Lucene.Net.Tests/Util/TestArrayUtil.cs
@@ -3,7 +3,6 @@
using RandomizedTesting.Generators;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Util
{
@@ -130,8 +129,7 @@ public virtual void TestParseInt()
}
catch (Exception e) when (e.IsNumberFormatException())
{
- Console.WriteLine(e.ToString());
- Console.Write(e.StackTrace);
+ e.PrintStackTrace();
Assert.IsTrue(false);
}
}
diff --git a/src/Lucene.Net.Tests/Util/TestConstants.cs b/src/Lucene.Net.Tests/Util/TestConstants.cs
index 7eafb70f2e..666afe3836 100644
--- a/src/Lucene.Net.Tests/Util/TestConstants.cs
+++ b/src/Lucene.Net.Tests/Util/TestConstants.cs
@@ -2,7 +2,6 @@
using System;
using System.Text.RegularExpressions;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Util
{
diff --git a/src/Lucene.Net.Tests/Util/TestFieldCacheSanityChecker.cs b/src/Lucene.Net.Tests/Util/TestFieldCacheSanityChecker.cs
index 05c4b323b4..58c9f8161d 100644
--- a/src/Lucene.Net.Tests/Util/TestFieldCacheSanityChecker.cs
+++ b/src/Lucene.Net.Tests/Util/TestFieldCacheSanityChecker.cs
@@ -1,10 +1,10 @@
using Lucene.Net.Documents;
using Lucene.Net.Search;
using NUnit.Framework;
+using System;
using System.Globalization;
using System.IO;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Util
{
diff --git a/src/Lucene.Net.Tests/Util/TestPriorityQueue.cs b/src/Lucene.Net.Tests/Util/TestPriorityQueue.cs
index 13999d8260..9df3c22f29 100644
--- a/src/Lucene.Net.Tests/Util/TestPriorityQueue.cs
+++ b/src/Lucene.Net.Tests/Util/TestPriorityQueue.cs
@@ -9,7 +9,6 @@
using System.Runtime.Serialization.Formatters.Binary;
#endif
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Util
{
diff --git a/src/Lucene.Net.Tests/Util/TestRollingBuffer.cs b/src/Lucene.Net.Tests/Util/TestRollingBuffer.cs
index de30241f28..fcf0a9a298 100644
--- a/src/Lucene.Net.Tests/Util/TestRollingBuffer.cs
+++ b/src/Lucene.Net.Tests/Util/TestRollingBuffer.cs
@@ -1,7 +1,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Util
{
diff --git a/src/Lucene.Net.Tests/Util/TestUnicodeUtil.cs b/src/Lucene.Net.Tests/Util/TestUnicodeUtil.cs
index bb8e736a7c..af63fe9d79 100644
--- a/src/Lucene.Net.Tests/Util/TestUnicodeUtil.cs
+++ b/src/Lucene.Net.Tests/Util/TestUnicodeUtil.cs
@@ -4,7 +4,6 @@
using NUnit.Framework;
using System;
using Assert = Lucene.Net.TestFramework.Assert;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Util
{
diff --git a/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs b/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs
index 81b24930d5..a4ff76a940 100644
--- a/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs
+++ b/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs
@@ -557,7 +557,7 @@ public override string ToString()
}
internal readonly Outputs fstOutputs = ByteSequenceOutputs.Singleton;
- internal BytesRef NO_OUTPUT;
+ internal readonly BytesRef NO_OUTPUT; // LUCENENET: marked readonly
///
/// BlockTree's implementation of .
diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs
index 26a5b54a7a..b813a9191c 100644
--- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs
+++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs
@@ -5,7 +5,6 @@
using Lucene.Net.Util;
using System;
using System.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Codecs.Lucene3x
@@ -48,7 +47,7 @@ namespace Lucene.Net.Codecs.Lucene3x
///
/// Exposes flex API on a pre-flex index, as a codec.
///
- /// @lucene.experimental
+ /// @lucene.experimental
///
[Obsolete("(4.0)")]
internal class Lucene3xFields : FieldsProducer
@@ -777,7 +776,7 @@ internal virtual void Reset(FieldInfo fieldInfo)
{
//System.out.println("pff.reset te=" + termEnum);
this.fieldInfo = fieldInfo;
-
+
internedFieldName = fieldInfo.Name.Intern();
Term term = new Term(internedFieldName);
@@ -1232,4 +1231,4 @@ public override void CheckIntegrity()
{
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Codecs/Lucene3x/SegmentTermEnum.cs b/src/Lucene.Net/Codecs/Lucene3x/SegmentTermEnum.cs
index 936c92888a..8597cec240 100644
--- a/src/Lucene.Net/Codecs/Lucene3x/SegmentTermEnum.cs
+++ b/src/Lucene.Net/Codecs/Lucene3x/SegmentTermEnum.cs
@@ -35,8 +35,8 @@ namespace Lucene.Net.Codecs.Lucene3x
internal sealed class SegmentTermEnum : IDisposable // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation
{
private IndexInput input;
- internal FieldInfos fieldInfos;
- internal long size;
+ internal readonly FieldInfos fieldInfos; // LUCENENET: marked readonly
+ internal readonly long size; // LUCENENET: marked readonly
internal long position = -1;
// Changed strings to true utf8 with length-in-bytes not
@@ -59,10 +59,10 @@ internal sealed class SegmentTermEnum : IDisposable // LUCENENET specific: Not i
private readonly int format; // LUCENENET: marked readonly
private readonly bool isIndex = false; // LUCENENET: marked readonly
internal long indexPointer = 0;
- internal int indexInterval; // LUCENENET NOTE: Changed from public field to internal (class is internal anyway)
- internal int skipInterval;
+ internal readonly int indexInterval; // LUCENENET NOTE: Changed from public field to internal (class is internal anyway), marked readonly
+ internal readonly int skipInterval; // LUCENENET: marked readonly
internal int newSuffixStart;
- internal int maxSkipLevels;
+ internal readonly int maxSkipLevels; // LUCENENET: marked readonly
private bool first = true;
public SegmentTermEnum(IndexInput i, FieldInfos fis, bool isi)
@@ -262,4 +262,4 @@ public void Dispose()
input.Dispose();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Codecs/Lucene3x/TermInfosReader.cs b/src/Lucene.Net/Codecs/Lucene3x/TermInfosReader.cs
index c08a988939..e2ff36dd5b 100644
--- a/src/Lucene.Net/Codecs/Lucene3x/TermInfosReader.cs
+++ b/src/Lucene.Net/Codecs/Lucene3x/TermInfosReader.cs
@@ -74,7 +74,7 @@ public TermInfoAndOrd(TermInfo ti, long termOrd)
private class CloneableTerm : DoubleBarrelLRUCache.CloneableKey
{
- internal Term term;
+ internal readonly Term term; // LUCENENET: marked readonly
public CloneableTerm(Term t)
{
diff --git a/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsWriter.cs b/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsWriter.cs
index 3a2e6b2292..78ddd01cee 100644
--- a/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsWriter.cs
+++ b/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsWriter.cs
@@ -191,7 +191,7 @@ public override void StartTerm(BytesRef term, int freq)
internal int lastOffset = 0;
internal int lastPayloadLength = -1; // force first payload to write its length
- internal BytesRef scratch = new BytesRef(); // used only by this optimized flush below
+ internal readonly BytesRef scratch = new BytesRef(); // used only by this optimized flush below // LUCENENET: marked readonly
public override void AddProx(int numProx, DataInput positions, DataInput offsets)
{
diff --git a/src/Lucene.Net/Document/Field.cs b/src/Lucene.Net/Document/Field.cs
index 36233835e0..8a2d27f80a 100644
--- a/src/Lucene.Net/Document/Field.cs
+++ b/src/Lucene.Net/Document/Field.cs
@@ -35,8 +35,8 @@ namespace Lucene.Net.Documents
///
/// Expert: directly create a field for a document. Most
- /// users should use one of the sugar subclasses: ,
- /// , , ,
+ /// users should use one of the sugar subclasses: ,
+ /// , , ,
/// , ,
/// , ,
/// , .
@@ -44,7 +44,7 @@ namespace Lucene.Net.Documents
/// A field is a section of a . Each field has three
/// parts: name, type and value. Values may be text
/// (, or pre-analyzed ), binary
- /// (), or numeric (, , , or ).
+ /// (), or numeric (, , , or ).
/// Fields are optionally stored in the
/// index, so that they may be returned with hits on the document.
///
@@ -72,7 +72,7 @@ public partial class Field : IIndexableField, IFormattable
private object fieldsData;
///
- /// Field's value
+ /// Field's value
///
/// Setting this property will automatically set the backing field for the
/// property.
@@ -320,7 +320,7 @@ public virtual string GetStringValue() // LUCENENET specific: Added verb Get to
/// An object that supplies culture-specific formatting information. This parameter has no effect if this field is non-numeric.
/// The string representation of the value if it is either a or numeric type.
// LUCENENET specific overload.
- public virtual string GetStringValue(IFormatProvider provider)
+ public virtual string GetStringValue(IFormatProvider provider)
{
return GetStringValue(null, provider);
}
@@ -333,7 +333,7 @@ public virtual string GetStringValue(IFormatProvider provider)
/// A standard or custom numeric format string. This parameter has no effect if this field is non-numeric.
/// The string representation of the value if it is either a or numeric type.
// LUCENENET specific overload.
- public virtual string GetStringValue(string format)
+ public virtual string GetStringValue(string format)
{
return GetStringValue(format, null);
}
@@ -411,7 +411,7 @@ public virtual void SetStringValue(string value)
}
///
- /// Expert: change the value of this field. See
+ /// Expert: change the value of this field. See
/// .
///
public virtual void SetReaderValue(TextReader value)
@@ -532,7 +532,7 @@ public virtual void SetDoubleValue(double value)
// LUCENENET TODO: Add SetValue() overloads for each type?
// Upside: Simpler API.
- // Downside: Must be vigilant about what type is passed or the wrong overload will be called and will get a runtime exception.
+ // Downside: Must be vigilant about what type is passed or the wrong overload will be called and will get a runtime exception.
///
/// Expert: sets the token stream to be used for indexing and causes
@@ -602,15 +602,15 @@ public virtual object GetNumericValue() // LUCENENET specific: Added verb Get to
///
/// Gets the of the underlying value, or if the value is not set or non-numeric.
///
- /// Expert: The difference between this property and is
+ /// Expert: The difference between this property and is
/// this is represents the current state of the field (whether being written or read) and the
/// property represents instructions on how the field will be written,
/// but does not re-populate when reading back from an index (it is write-only).
///
- /// In Java, the numeric type was determined by checking the type of
+ /// In Java, the numeric type was determined by checking the type of
/// . However, since there are no reference number
/// types in .NET, using so will cause boxing/unboxing. It is
- /// therefore recommended to use this property to check the underlying type and the corresponding
+ /// therefore recommended to use this property to check the underlying type and the corresponding
/// Get*Value() method to retrieve the value.
///
/// NOTE: Since Lucene codecs do not support or ,
@@ -770,7 +770,7 @@ public override string ToString()
}
///
- /// Prints a for human consumption.
+ /// Prints a for human consumption.
///
/// A standard or custom numeric format string. This parameter has no effect if this field is non-numeric.
// LUCENENET specific - method added for better .NET compatibility
@@ -906,8 +906,8 @@ public virtual TokenStream GetTokenStream(Analyzer analyzer)
internal sealed class StringTokenStream : TokenStream
{
- internal ICharTermAttribute termAttribute;
- internal IOffsetAttribute offsetAttribute;
+ internal readonly ICharTermAttribute termAttribute; // LUCENENET: marked readonly
+ internal readonly IOffsetAttribute offsetAttribute; // LUCENENET: marked readonly
internal bool used = false;
internal string value = null;
@@ -985,7 +985,7 @@ public enum Store
//
///
- /// Specifies whether and how a field should be indexed.
+ /// Specifies whether and how a field should be indexed.
///
[Obsolete("This is here only to ease transition from the pre-4.0 APIs.")]
public enum Index
@@ -1035,13 +1035,13 @@ public enum Index
}
///
- /// Specifies whether and how a field should have term vectors.
+ /// Specifies whether and how a field should have term vectors.
///
[Obsolete("This is here only to ease transition from the pre-4.0 APIs.")]
public enum TermVector
{
///
- /// Do not store term vectors.
+ /// Do not store term vectors.
///
NO,
@@ -1197,7 +1197,7 @@ public Field(string name, TextReader reader)
}
///
- /// Create a tokenized and indexed field that is not stored, optionally with
+ /// Create a tokenized and indexed field that is not stored, optionally with
/// storing term vectors. The is read only when the is added to the index,
/// i.e. you may not close the until
/// has been called.
@@ -1229,7 +1229,7 @@ public Field(string name, TokenStream tokenStream)
}
///
- /// Create a tokenized and indexed field that is not stored, optionally with
+ /// Create a tokenized and indexed field that is not stored, optionally with
/// storing term vectors. This is useful for pre-analyzed fields.
/// The is read only when the is added to the index,
/// i.e. you may not close the until
@@ -1412,7 +1412,7 @@ public static Field.Index ToIndex(bool indexed, bool analyed)
}
[Obsolete("This is here only to ease transition from the pre-4.0 APIs.")]
- public static Field.Index ToIndex(bool indexed, bool analyzed, bool omitNorms)
+ public static Field.Index ToIndex(bool indexed, bool analyzed, bool omitNorms)
{
// If it is not indexed nothing else matters
if (!indexed)
@@ -1473,8 +1473,8 @@ public static Field.TermVector ToTermVector(bool stored, bool withOffsets, bool
// LUCENENET specific
// Since we have more numeric types on Field than on FieldType,
// a new enumeration was created for .NET. In Java, this type was
- // determined by checking the data type of the Field.numericValue()
- // method. However, since the corresponding GetNumericValue() method
+ // determined by checking the data type of the Field.numericValue()
+ // method. However, since the corresponding GetNumericValue() method
// in .NET returns type object (which would result in boxing/unboxing),
// this has been refactored to use an enumeration instead, which makes the
// API easier to use.
@@ -1511,8 +1511,8 @@ public enum NumericFieldType
SINGLE,
///
- /// 64-bit double numeric type
+ /// 64-bit double numeric type
///
DOUBLE
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Index/CheckIndex.cs b/src/Lucene.Net/Index/CheckIndex.cs
index 6eb9d94c89..a5837af526 100644
--- a/src/Lucene.Net/Index/CheckIndex.cs
+++ b/src/Lucene.Net/Index/CheckIndex.cs
@@ -8,7 +8,6 @@
using System.Globalization;
using System.IO;
using System.Threading;
-using Console = Lucene.Net.Util.SystemConsole;
using Integer = J2N.Numerics.Int32;
using JCG = J2N.Collections.Generic;
@@ -520,11 +519,10 @@ public virtual Status DoCheckIndex(IList onlySegments)
Msg(infoStream, "ERROR: could not read any segments file in directory");
result.MissingSegments = true;
- // LUCENENET NOTE: Some tests rely on the error type being in
- // the message. We can't get the error type with StackTrace, we
- // need ToString() for that.
- infoStream?.WriteLine(t.ToString());
- //infoStream.WriteLine(t.StackTrace);
+ if (infoStream != null)
+ {
+ t.PrintStackTrace(infoStream);
+ }
return result;
}
@@ -568,11 +566,10 @@ public virtual Status DoCheckIndex(IList onlySegments)
{
Msg(infoStream, "ERROR: could not open segments file in directory");
- // LUCENENET NOTE: Some tests rely on the error type being in
- // the message. We can't get the error type with StackTrace, we
- // need ToString() for that.
- infoStream?.WriteLine(t.ToString());
- //infoStream.WriteLine(t.StackTrace);
+ if (infoStream != null)
+ {
+ t.PrintStackTrace(infoStream);
+ }
result.CantOpenSegments = true;
return result;
@@ -586,11 +583,10 @@ public virtual Status DoCheckIndex(IList onlySegments)
{
Msg(infoStream, "ERROR: could not read segment file version in directory");
- // LUCENENET NOTE: Some tests rely on the error type being in
- // the message. We can't get the error type with StackTrace, we
- // need ToString() for that.
- infoStream?.WriteLine(t.ToString());
- //infoStream.WriteLine(t.StackTrace);
+ if (infoStream != null)
+ {
+ t.PrintStackTrace(infoStream);
+ }
result.MissingSegmentVersion = true;
return result;
@@ -874,10 +870,10 @@ public virtual Status DoCheckIndex(IList onlySegments)
comment = "fixIndex() would remove reference to this segment";
Msg(infoStream, " WARNING: " + comment + "; full exception:");
- // LUCENENET NOTE: Some tests rely on the error type being in
- // the message. We can't get the error type with StackTrace, we
- // need ToString() for that.
- infoStream?.WriteLine(t.ToString());
+ if (infoStream != null)
+ {
+ t.PrintStackTrace(infoStream);
+ }
Msg(infoStream, "");
result.TotLoseDocCount += toLoseDocCount;
@@ -960,11 +956,10 @@ public static Status.FieldNormStatus TestFieldNorms(AtomicReader reader, TextWri
Msg(infoStream, "ERROR [" + e.Message + "]");
status.Error = e;
- // LUCENENET NOTE: Some tests rely on the error type being in
- // the message. We can't get the error type with StackTrace, we
- // need ToString() for that.
- infoStream?.WriteLine(e.ToString());
- //infoStream.WriteLine(e.StackTrace);
+ if (infoStream != null)
+ {
+ e.PrintStackTrace(infoStream);
+ }
}
return status;
@@ -1666,11 +1661,10 @@ public static Status.TermIndexStatus TestPostings(AtomicReader reader, TextWrite
status = new Status.TermIndexStatus();
status.Error = e;
- // LUCENENET NOTE: Some tests rely on the error type being in
- // the message. We can't get the error type with StackTrace, we
- // need ToString() for that.
- infoStream?.WriteLine(e.ToString());
- //infoStream.WriteLine(e.StackTrace);
+ if (infoStream != null)
+ {
+ e.PrintStackTrace(infoStream);
+ }
}
return status;
@@ -1716,11 +1710,10 @@ public static Status.StoredFieldStatus TestStoredFields(AtomicReader reader, Tex
Msg(infoStream, "ERROR [" + e.Message + "]");
status.Error = e;
- // LUCENENET NOTE: Some tests rely on the error type being in
- // the message. We can't get the error type with StackTrace, we
- // need ToString() for that.
- infoStream?.WriteLine(e.ToString());
- //infoStream.WriteLine(e.StackTrace);
+ if (infoStream != null)
+ {
+ e.PrintStackTrace(infoStream);
+ }
}
return status;
@@ -1761,11 +1754,10 @@ public static Status.DocValuesStatus TestDocValues(AtomicReader reader, TextWrit
Msg(infoStream, "ERROR [" + e.Message + "]");
status.Error = e;
- // LUCENENET NOTE: Some tests rely on the error type being in
- // the message. We can't get the error type with StackTrace, we
- // need ToString() for that.
- infoStream?.WriteLine(e.ToString());
- //infoStream.WriteLine(e.StackTrace);
+ if (infoStream != null)
+ {
+ e.PrintStackTrace(infoStream);
+ }
}
return status;
}
@@ -2284,11 +2276,10 @@ public static Status.TermVectorStatus TestTermVectors(AtomicReader reader, TextW
Msg(infoStream, "ERROR [" + e.Message + "]");
status.Error = e;
- // LUCENENET NOTE: Some tests rely on the error type being in
- // the message. We can't get the error type with StackTrace, we
- // need ToString() for that.
- infoStream?.WriteLine(e.ToString());
- //infoStream.WriteLine(e.StackTrace);
+ if (infoStream != null)
+ {
+ e.PrintStackTrace(infoStream);
+ }
}
return status;
diff --git a/src/Lucene.Net/Index/ConcurrentMergeScheduler.cs b/src/Lucene.Net/Index/ConcurrentMergeScheduler.cs
index b506af1e98..c1f55341c8 100644
--- a/src/Lucene.Net/Index/ConcurrentMergeScheduler.cs
+++ b/src/Lucene.Net/Index/ConcurrentMergeScheduler.cs
@@ -293,7 +293,7 @@ protected virtual void UpdateMergeThreads()
/// conjunction with , like that:
///
///
- /// if (IsVerbose)
+ /// if (IsVerbose)
/// {
/// Message("your message");
/// }
@@ -571,8 +571,8 @@ protected internal class MergeThread : ThreadJob
{
private readonly ConcurrentMergeScheduler outerInstance;
- internal IndexWriter tWriter;
- internal MergePolicy.OneMerge startMerge;
+ internal readonly IndexWriter tWriter; // LUCENENET: marked readonly
+ internal readonly MergePolicy.OneMerge startMerge; // LUCENENET: marked readonly
internal MergePolicy.OneMerge runningMerge;
private volatile bool done;
@@ -616,7 +616,7 @@ public virtual MergePolicy.OneMerge RunningMerge
}
///
- /// Return the current merge, or null if this
+ /// Return the current merge, or null if this
/// is done.
///
public virtual MergePolicy.OneMerge CurrentMerge
@@ -814,4 +814,4 @@ public override object Clone()
return clone;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Index/DocumentsWriterPerThread.cs b/src/Lucene.Net/Index/DocumentsWriterPerThread.cs
index e71af22fe9..6ac584bbdf 100644
--- a/src/Lucene.Net/Index/DocumentsWriterPerThread.cs
+++ b/src/Lucene.Net/Index/DocumentsWriterPerThread.cs
@@ -105,7 +105,7 @@ public class DocState
{
internal readonly DocumentsWriterPerThread docWriter;
internal Analyzer analyzer;
- internal InfoStream infoStream;
+ internal readonly InfoStream infoStream; // LUCENENET: marked readonly
internal Similarity similarity;
internal int docID;
internal IEnumerable doc;
diff --git a/src/Lucene.Net/Index/FreqProxTermsWriterPerField.cs b/src/Lucene.Net/Index/FreqProxTermsWriterPerField.cs
index 3fd3db8889..de5a18a812 100644
--- a/src/Lucene.Net/Index/FreqProxTermsWriterPerField.cs
+++ b/src/Lucene.Net/Index/FreqProxTermsWriterPerField.cs
@@ -328,11 +328,11 @@ public FreqProxPostingsArray(int size, bool writeFreqs, bool writeProx, bool wri
//System.out.println("PA init freqs=" + writeFreqs + " pos=" + writeProx + " offs=" + writeOffsets);
}
- internal int[] termFreqs; // # times this term occurs in the current doc
- internal int[] lastDocIDs; // Last docID where this term occurred
- internal int[] lastDocCodes; // Code for prior doc
- internal int[] lastPositions; // Last position where this term occurred
- internal int[] lastOffsets; // Last endOffset where this term occurred
+ internal readonly int[] termFreqs; // # times this term occurs in the current doc // LUCENENET: marked readonly
+ internal readonly int[] lastDocIDs; // Last docID where this term occurred // LUCENENET: marked readonly
+ internal readonly int[] lastDocCodes; // Code for prior doc // LUCENENET: marked readonly
+ internal readonly int[] lastPositions; // Last position where this term occurred // LUCENENET: marked readonly
+ internal readonly int[] lastOffsets; // Last endOffset where this term occurred // LUCENENET: marked readonly
internal override ParallelPostingsArray NewInstance(int size)
{
diff --git a/src/Lucene.Net/Index/FrozenBufferedUpdates.cs b/src/Lucene.Net/Index/FrozenBufferedUpdates.cs
index b9968577c1..7afdee629a 100644
--- a/src/Lucene.Net/Index/FrozenBufferedUpdates.cs
+++ b/src/Lucene.Net/Index/FrozenBufferedUpdates.cs
@@ -40,7 +40,7 @@ internal class FrozenBufferedUpdates
/// Terms, in sorted order:
internal readonly PrefixCodedTerms terms;
- internal int termCount; // just for debugging
+ internal readonly int termCount; // just for debugging // LUCENENET: marked readonly
/// Parallel array of deleted query, and the docIDUpto for each
internal readonly Query[] queries;
@@ -252,4 +252,4 @@ public virtual bool Any()
return termCount > 0 || queries.Length > 0 || numericDVUpdates.Length > 0 || binaryDVUpdates.Length > 0;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Index/IndexFileDeleter.cs b/src/Lucene.Net/Index/IndexFileDeleter.cs
index 85b7a8eeea..f412ac5998 100644
--- a/src/Lucene.Net/Index/IndexFileDeleter.cs
+++ b/src/Lucene.Net/Index/IndexFileDeleter.cs
@@ -249,7 +249,7 @@ public IndexFileDeleter(Directory directory, IndexDeletionPolicy policy, Segment
}
catch (Exception e) when (e.IsIOException())
{
- throw new CorruptIndexException("failed to locate current segments_N file \"" + currentSegmentsFile + "\"" + e.ToString(), e);
+ throw new CorruptIndexException("failed to locate current segments_N file \"" + currentSegmentsFile + "\"" + e, e); // LUCENENET specific: add exception logging and inner exception
}
if (infoStream.IsEnabled("IFD"))
{
@@ -694,7 +694,7 @@ internal void DeleteFile(string fileName)
if (infoStream.IsEnabled("IFD"))
{
infoStream.Message("IFD",
- "unable to remove file \"" + fileName + "\": " + e.ToString() + "; Will re-try later.");
+ "unable to remove file \"" + fileName + "\": " + e.ToTypeMessageString() + "; Will re-try later."); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior
}
if (deletable is null)
{
@@ -750,12 +750,12 @@ public int DecRef()
private sealed class CommitPoint : IndexCommit
{
- internal ICollection files;
- internal string segmentsFileName;
+ internal readonly ICollection files; // LUCENENET: marked readonly
+ internal readonly string segmentsFileName; // LUCENENET: marked readonly
internal bool deleted;
- internal Directory directory;
- internal ICollection commitsToDelete;
- internal long generation;
+ internal readonly Directory directory; // LUCENENET: marked readonly
+ internal readonly ICollection commitsToDelete; // LUCENENET: marked readonly
+ internal readonly long generation; // LUCENENET: marked readonly
internal readonly IDictionary userData;
internal readonly int segmentCount;
diff --git a/src/Lucene.Net/Index/IndexUpgrader.cs b/src/Lucene.Net/Index/IndexUpgrader.cs
index ae1e3cdafb..78979cf383 100644
--- a/src/Lucene.Net/Index/IndexUpgrader.cs
+++ b/src/Lucene.Net/Index/IndexUpgrader.cs
@@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.IO;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Index
{
diff --git a/src/Lucene.Net/Index/IndexWriter.cs b/src/Lucene.Net/Index/IndexWriter.cs
index f98cdd709f..be24ca1a11 100644
--- a/src/Lucene.Net/Index/IndexWriter.cs
+++ b/src/Lucene.Net/Index/IndexWriter.cs
@@ -271,7 +271,7 @@ public class IndexWriter : IDisposable, ITwoPhaseCommit
internal readonly AtomicInt32 flushCount = new AtomicInt32();
internal readonly AtomicInt32 flushDeletesCount = new AtomicInt32();
- internal ReaderPool readerPool;
+ internal readonly ReaderPool readerPool; // LUCENENET: marked readonly
internal readonly BufferedUpdatesStream bufferedUpdatesStream;
// this is a "write once" variable (like the organic dye
diff --git a/src/Lucene.Net/Index/StandardDirectoryReader.cs b/src/Lucene.Net/Index/StandardDirectoryReader.cs
index 19776dd153..e22a17f94d 100644
--- a/src/Lucene.Net/Index/StandardDirectoryReader.cs
+++ b/src/Lucene.Net/Index/StandardDirectoryReader.cs
@@ -506,10 +506,10 @@ public override IndexCommit IndexCommit
internal sealed class ReaderCommit : IndexCommit
{
- internal string segmentsFileName;
- internal ICollection files;
- internal Directory dir;
- internal long generation;
+ internal readonly string segmentsFileName; // LUCENENET: marked readonly
+ internal readonly ICollection files; // LUCENENET: marked readonly
+ internal readonly Directory dir; // LUCENENET: marked readonly
+ internal readonly long generation; // LUCENENET: marked readonly
internal readonly IDictionary userData;
internal readonly int segmentCount;
@@ -548,4 +548,4 @@ public override void Delete()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Index/TermVectorsConsumerPerField.cs b/src/Lucene.Net/Index/TermVectorsConsumerPerField.cs
index 87d43314d6..64631edb3c 100644
--- a/src/Lucene.Net/Index/TermVectorsConsumerPerField.cs
+++ b/src/Lucene.Net/Index/TermVectorsConsumerPerField.cs
@@ -146,7 +146,7 @@ internal override bool Start(IIndexableField[] fields, int count)
/// Called once per field per document if term vectors
/// are enabled, to write the vectors to
/// RAMOutputStream, which is then quickly flushed to
- /// the real term vectors files in the Directory.
+ /// the real term vectors files in the Directory.
///
internal override void Finish()
{
@@ -330,9 +330,9 @@ public TermVectorsPostingsArray(int size)
lastPositions = new int[size];
}
- internal int[] freqs; // How many times this term occurred in the current doc
- internal int[] lastOffsets; // Last offset we saw
- internal int[] lastPositions; // Last position where this term occurred
+ internal readonly int[] freqs; // How many times this term occurred in the current doc // LUCENENET: marked readonly
+ internal readonly int[] lastOffsets; // Last offset we saw // LUCENENET: marked readonly
+ internal readonly int[] lastPositions; // Last position where this term occurred // LUCENENET: marked readonly
internal override ParallelPostingsArray NewInstance(int size)
{
@@ -357,4 +357,4 @@ internal override int BytesPerPosting()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Search/BooleanScorer2.cs b/src/Lucene.Net/Search/BooleanScorer2.cs
index 7fa1c89fb3..fffdf5165b 100644
--- a/src/Lucene.Net/Search/BooleanScorer2.cs
+++ b/src/Lucene.Net/Search/BooleanScorer2.cs
@@ -114,7 +114,7 @@ private class SingleMatchScorer : Scorer
{
private readonly BooleanScorer2 outerInstance;
- internal Scorer scorer;
+ internal readonly Scorer scorer; // LUCENENET: marked readonly
internal int lastScoredDoc = -1;
// Save the score of lastScoredDoc, so that we don't compute it more than
@@ -274,7 +274,7 @@ private Scorer DualConjunctionSumScorer(/* bool disableCoord, // LUCENENET: Not
///
private Scorer MakeCountingSumScorer(/* bool disableCoord // LUCENENET: Not Referenced */) // each scorer counted as a single matcher
{
- return (requiredScorers.Count == 0)
+ return (requiredScorers.Count == 0)
? MakeCountingSumScorerNoReq(/* disableCoord // LUCENENET: Not Referenced */)
: MakeCountingSumScorerSomeReq(/* disableCoord // LUCENENET: Not Referenced */);
}
@@ -376,4 +376,4 @@ public override ICollection GetChildren()
return children;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Search/ConstantScoreAutoRewrite.cs b/src/Lucene.Net/Search/ConstantScoreAutoRewrite.cs
index 083c9d3b60..0f2dd95b9c 100644
--- a/src/Lucene.Net/Search/ConstantScoreAutoRewrite.cs
+++ b/src/Lucene.Net/Search/ConstantScoreAutoRewrite.cs
@@ -178,7 +178,7 @@ public override bool Collect(BytesRef bytes)
internal readonly int docCountCutoff, termCountLimit;
internal readonly TermStateByteStart array = new TermStateByteStart(16);
- internal BytesRefHash pendingTerms;
+ internal readonly BytesRefHash pendingTerms; // LUCENENET: marked readonly
}
public override int GetHashCode()
diff --git a/src/Lucene.Net/Search/ExactPhraseScorer.cs b/src/Lucene.Net/Search/ExactPhraseScorer.cs
index bcc7aaa600..ed33290c1a 100644
--- a/src/Lucene.Net/Search/ExactPhraseScorer.cs
+++ b/src/Lucene.Net/Search/ExactPhraseScorer.cs
@@ -33,7 +33,7 @@ internal sealed class ExactPhraseScorer : Scorer
private readonly int[] counts = new int[CHUNK];
private readonly int[] gens = new int[CHUNK];
- internal bool noDocs;
+ internal readonly bool noDocs; // LUCENENET: marked readonly
private readonly long cost;
private sealed class ChunkState
@@ -358,4 +358,4 @@ public override long GetCost()
return cost;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Search/FieldCacheImpl.cs b/src/Lucene.Net/Search/FieldCacheImpl.cs
index 08464b59e5..b038c5c377 100644
--- a/src/Lucene.Net/Search/FieldCacheImpl.cs
+++ b/src/Lucene.Net/Search/FieldCacheImpl.cs
@@ -290,7 +290,7 @@ private protected Cache(FieldCacheImpl wrapper) // LUCENENET: Changed from inter
internal readonly FieldCacheImpl wrapper;
- internal ConditionalWeakTable> readerCache = new ConditionalWeakTable>();
+ internal readonly ConditionalWeakTable> readerCache = new ConditionalWeakTable>(); // LUCENENET: marked readonly
protected abstract TValue CreateValue(AtomicReader reader, TKey key, bool setDocsWithField);
@@ -427,7 +427,7 @@ private void PrintNewInsanity(TextWriter infoStream, TValue value)
// OK this insanity involves our entry
infoStream.WriteLine("WARNING: new FieldCache insanity created\nDetails: " + insanity.ToString());
infoStream.WriteLine("\nStack:\n");
- infoStream.WriteLine(new Exception().StackTrace);
+ StackTraceHelper.PrintCurrentStackTrace(infoStream);
break;
}
}
@@ -486,7 +486,7 @@ public override int GetHashCode()
// LUCENENET specific - Added generic parameter to eliminate casting/boxing
internal class CacheKey : CacheKey
{
- internal readonly TCustom custom; // which custom comparer or parser
+ internal readonly TCustom custom; // which custom comparer or parser
///
/// Creates one of these objects for a custom comparer/parser.
@@ -775,7 +775,7 @@ protected override TermsEnum GetTermsEnum(Terms terms)
/// Checks the internal cache for an appropriate entry, and if none is
/// found, reads the terms in as s and returns an array
/// of size reader.MaxDoc of the value each document
- /// has in the given field.
+ /// has in the given field.
///
/// NOTE: this was getShorts() in Lucene
///
@@ -795,7 +795,7 @@ public virtual FieldCache.Int16s GetInt16s(AtomicReader reader, string field, bo
/// Checks the internal cache for an appropriate entry, and if none is found,
/// reads the terms in as shorts and returns an array of
/// size reader.MaxDoc of the value each document has in the
- /// given field.
+ /// given field.
///
/// NOTE: this was getShorts() in Lucene
///
diff --git a/src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs b/src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs
index 816dc404dd..558b27f9ed 100644
--- a/src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs
+++ b/src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs
@@ -210,7 +210,7 @@ public class PayloadNearSpanScorer : SpanScorer
{
private readonly PayloadNearQuery outerInstance;
- internal Spans spans;
+ internal readonly Spans spans; // LUCENENET: marked readonly
protected internal float m_payloadScore;
internal int payloadsSeen;
@@ -251,7 +251,7 @@ public virtual void GetPayloads(Spans[] subSpans)
}
// TODO change the whole spans api to use bytesRef, or nuke spans
- internal BytesRef scratch = new BytesRef();
+ internal readonly BytesRef scratch = new BytesRef(); // LUCENENET: marked readonly
///
/// By default, uses the to score the payloads, but
diff --git a/src/Lucene.Net/Search/PhrasePositions.cs b/src/Lucene.Net/Search/PhrasePositions.cs
index d90d4b4e4a..a9bd7b7e5d 100644
--- a/src/Lucene.Net/Search/PhrasePositions.cs
+++ b/src/Lucene.Net/Search/PhrasePositions.cs
@@ -27,7 +27,7 @@ internal sealed class PhrasePositions
internal int doc; // current doc
internal int position; // position in doc
internal int count; // remaining pos in this doc
- internal int offset; // position in phrase
+ internal readonly int offset; // position in phrase // LUCENENET: marked readonly
internal readonly int ord; // unique across all PhrasePositions instances
internal readonly DocsAndPositionsEnum postings; // stream of docs & positions
internal PhrasePositions next; // used to make lists
@@ -100,4 +100,4 @@ public override string ToString()
return s;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Search/PhraseQuery.cs b/src/Lucene.Net/Search/PhraseQuery.cs
index b579477448..cc0f1e0164 100644
--- a/src/Lucene.Net/Search/PhraseQuery.cs
+++ b/src/Lucene.Net/Search/PhraseQuery.cs
@@ -304,7 +304,7 @@ private class PhraseWeight : Weight
internal readonly Similarity.SimWeight stats;
- internal TermContext[] states;
+ internal readonly TermContext[] states; // LUCENENET: marked readonly
public PhraseWeight(PhraseQuery outerInstance, IndexSearcher searcher)
{
diff --git a/src/Lucene.Net/Search/ScoringRewrite.cs b/src/Lucene.Net/Search/ScoringRewrite.cs
index 31e4996fd7..cd90ba3a84 100644
--- a/src/Lucene.Net/Search/ScoringRewrite.cs
+++ b/src/Lucene.Net/Search/ScoringRewrite.cs
@@ -147,7 +147,7 @@ public ParallelArraysTermCollector(ScoringRewrite outerInstance)
}
internal readonly TermFreqBoostByteStart array = new TermFreqBoostByteStart(16);
- internal BytesRefHash terms;
+ internal readonly BytesRefHash terms; // LUCENENET: marked readonly
internal TermsEnum termsEnum;
private IBoostAttribute boostAtt;
diff --git a/src/Lucene.Net/Search/SortField.cs b/src/Lucene.Net/Search/SortField.cs
index 299ad948cf..4dd0980558 100644
--- a/src/Lucene.Net/Search/SortField.cs
+++ b/src/Lucene.Net/Search/SortField.cs
@@ -48,7 +48,7 @@ public class SortField
private string field;
private SortFieldType type; // defaults to determining type dynamically
- internal bool reverse = false; // defaults to natural order
+ internal readonly bool reverse /*= false*/; // defaults to natural order // LUCENENET: marked readonly
private readonly FieldCache.IParser parser; // LUCENENET: marked readonly
// Used for CUSTOM sort
diff --git a/src/Lucene.Net/Search/Spans/NearSpansUnordered.cs b/src/Lucene.Net/Search/Spans/NearSpansUnordered.cs
index ef81809b2b..ab60f8c09a 100644
--- a/src/Lucene.Net/Search/Spans/NearSpansUnordered.cs
+++ b/src/Lucene.Net/Search/Spans/NearSpansUnordered.cs
@@ -80,7 +80,7 @@ private class SpansCell : Spans
{
private readonly NearSpansUnordered outerInstance;
- internal Spans spans;
+ internal readonly Spans spans; // LUCENENET: marked readonly
internal SpansCell next;
private int length = -1;
private readonly int index; // LUCENENET: marked readonly
@@ -384,4 +384,4 @@ private void ListToQueue()
private bool AtMatch => (Min.Doc == max.Doc) && ((max.End - Min.Start - totalLength) <= slop);
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Store/LockStressTest.cs b/src/Lucene.Net/Store/LockStressTest.cs
index 1ef271052f..20a3156cab 100644
--- a/src/Lucene.Net/Store/LockStressTest.cs
+++ b/src/Lucene.Net/Store/LockStressTest.cs
@@ -6,7 +6,6 @@
using System.Net.Sockets;
using System.Text;
using System.Threading;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Store
{
diff --git a/src/Lucene.Net/Store/LockVerifyServer.cs b/src/Lucene.Net/Store/LockVerifyServer.cs
index 876da8ebc9..6118978761 100644
--- a/src/Lucene.Net/Store/LockVerifyServer.cs
+++ b/src/Lucene.Net/Store/LockVerifyServer.cs
@@ -8,7 +8,6 @@
using System.Net.Sockets;
using System.Text;
using System.Threading;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Store
{
diff --git a/src/Lucene.Net/Store/NRTCachingDirectory.cs b/src/Lucene.Net/Store/NRTCachingDirectory.cs
index 55ee2b3d82..bd3af979de 100644
--- a/src/Lucene.Net/Store/NRTCachingDirectory.cs
+++ b/src/Lucene.Net/Store/NRTCachingDirectory.cs
@@ -2,7 +2,6 @@
using Lucene.Net.Support.Threading;
using System;
using System.Collections.Generic;
-using Console = Lucene.Net.Util.SystemConsole;
using JCG = J2N.Collections.Generic;
namespace Lucene.Net.Store
@@ -307,7 +306,7 @@ public override IndexInput OpenInput(string name, IOContext context)
{
Console.WriteLine("nrtdir.openInput name=" + name);
}
-
+
#pragma warning disable 612, 618
if (cache.FileExists(name))
#pragma warning restore 612, 618
@@ -460,4 +459,4 @@ private void UnCache(string fileName)
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Store/SimpleFSLockFactory.cs b/src/Lucene.Net/Store/SimpleFSLockFactory.cs
index 3008a3c9d7..43ec74ebe1 100644
--- a/src/Lucene.Net/Store/SimpleFSLockFactory.cs
+++ b/src/Lucene.Net/Store/SimpleFSLockFactory.cs
@@ -103,8 +103,8 @@ public override void ClearLock(string lockName)
internal class SimpleFSLock : Lock
{
- internal string lockFile; // LUCENENET specific: changed to use string file name instead of allocating a FileInfo (#832)
- internal DirectoryInfo lockDir;
+ internal readonly string lockFile; // LUCENENET specific: marked readonly, changed to use string file name instead of allocating a FileInfo (#832)
+ internal readonly DirectoryInfo lockDir; // LUCENENET: marked readonly
public SimpleFSLock(DirectoryInfo lockDir, string lockFileName)
{
diff --git a/src/Lucene.Net/Store/SingleInstanceLockFactory.cs b/src/Lucene.Net/Store/SingleInstanceLockFactory.cs
index f78bc0b54a..ba411b7337 100644
--- a/src/Lucene.Net/Store/SingleInstanceLockFactory.cs
+++ b/src/Lucene.Net/Store/SingleInstanceLockFactory.cs
@@ -61,7 +61,7 @@ public override void ClearLock(string lockName)
internal class SingleInstanceLock : Lock
{
- internal string lockName;
+ internal readonly string lockName; // LUCENENET: marked readonly
private readonly JCG.HashSet locks;
public SingleInstanceLock(JCG.HashSet locks, string lockName)
@@ -117,4 +117,4 @@ public override string ToString()
return base.ToString() + ": " + lockName;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Support/ExceptionHandling/ExceptionExtensions.cs b/src/Lucene.Net/Support/ExceptionHandling/ExceptionExtensions.cs
index 09ba5bdf78..d422c7d646 100644
--- a/src/Lucene.Net/Support/ExceptionHandling/ExceptionExtensions.cs
+++ b/src/Lucene.Net/Support/ExceptionHandling/ExceptionExtensions.cs
@@ -8,6 +8,7 @@
using System.Security;
using System.Text;
using System.Threading;
+using PublicExceptionExtensions = Lucene.Net.Util.ExceptionExtensions;
namespace Lucene
{
@@ -698,5 +699,68 @@ public static bool IsServiceConfigurationError(this Exception e)
// it is not sensible to make a public exception that will be factored out along with it.
return e is ServiceConfigurationError;
}
+
+ ///
+ /// Prints the stack trace of the exception to the console's standard error output stream.
+ ///
+ /// This method mimics Java's behavior of printing the exception type and message first before the stack trace.
+ /// In .NET, this is done by calling .
+ /// Additionally, it will print any suppressed exceptions stored in
+ /// via .
+ ///
+ /// The exception to print.
+ public static void PrintStackTrace(this Exception e)
+ {
+ Console.Error.WriteLine(FormatStackTrace(e));
+ }
+
+ ///
+ /// Prints the stack trace of the exception to the specified .
+ ///
+ /// This method mimics Java's behavior of printing the exception type and message first before the stack trace.
+ /// In .NET, this is done by calling .
+ /// Additionally, it will print any suppressed exceptions stored in
+ /// via .
+ ///
+ /// The exception to print.
+ /// The destination to write the stack trace to.
+ public static void PrintStackTrace(this Exception e, TextWriter destination)
+ {
+ destination.WriteLine(FormatStackTrace(e));
+ }
+
+ private static string FormatStackTrace(this Exception e)
+ {
+ var suppressed = PublicExceptionExtensions.GetSuppressedAsListOrDefault(e);
+
+ if (suppressed == null)
+ {
+ return e.ToString();
+ }
+
+ StringBuilder sb = new();
+ sb.AppendLine(e.ToString());
+
+ foreach (var suppressedException in suppressed)
+ {
+ sb.Append("Suppressed: ").AppendLine(suppressedException.ToString());
+ }
+
+ return sb.ToString();
+ }
+
+ ///
+ /// Gets a string representation of the exception, including the exception type and message.
+ ///
+ /// In Java, calling toString() on an exception returns the exception type and message,
+ /// without the stack trace. This method mimics that behavior.
+ ///
+ /// The exception to get the string representation of.
+ /// A string representation of the exception, including the exception type and message.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static string ToTypeMessageString(this Exception e)
+ {
+ return $"{e.GetType().FullName}: {e.Message}";
+ }
}
}
diff --git a/src/Lucene.Net/Support/ExceptionHandling/StackTraceHelper.cs b/src/Lucene.Net/Support/ExceptionHandling/StackTraceHelper.cs
new file mode 100644
index 0000000000..ba31f9aafe
--- /dev/null
+++ b/src/Lucene.Net/Support/ExceptionHandling/StackTraceHelper.cs
@@ -0,0 +1,111 @@
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Runtime.CompilerServices;
+#nullable enable
+
+namespace Lucene.Net.Util
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ ///
+ /// LUCENENET specific class to provide some additional functionality around stack traces.
+ ///
+ internal static class StackTraceHelper
+ {
+ ///
+ /// Matches the StackTrace for a method name.
+ ///
+ /// IMPORTANT: To make the tests pass in release mode, the method(s) named here
+ /// must be decorated with [MethodImpl(MethodImplOptions.NoInlining)].
+ ///
+ public static bool DoesStackTraceContainMethod(string methodName)
+ {
+ if (methodName is null)
+ {
+ throw new ArgumentNullException(nameof(methodName));
+ }
+
+ StackTrace trace = new StackTrace();
+ // ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract
+ StackFrame[] frames = trace.GetFrames() ?? Array.Empty(); // NOTE: .NET Framework can return null here
+
+ foreach (var frame in frames)
+ {
+ if (frame.GetMethod()?.Name.Equals(methodName, StringComparison.Ordinal) == true)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ ///
+ /// Matches the StackTrace for a particular class (not fully-qualified) and method name.
+ ///
+ /// IMPORTANT: To make the tests pass in release mode, the method(s) named here
+ /// must be decorated with [MethodImpl(MethodImplOptions.NoInlining)].
+ ///
+ public static bool DoesStackTraceContainMethod(string className, string methodName)
+ {
+ if (className is null)
+ {
+ throw new ArgumentNullException(nameof(className));
+ }
+ if (methodName is null)
+ {
+ throw new ArgumentNullException(nameof(methodName));
+ }
+
+ StackTrace trace = new StackTrace();
+ // ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract
+ StackFrame[] frames = trace.GetFrames() ?? Array.Empty(); // NOTE: .NET Framework can return null here
+
+ foreach (var frame in frames)
+ {
+ var method = frame.GetMethod();
+ if (method?.DeclaringType?.Name.Equals(className, StringComparison.Ordinal) == true
+ && method.Name.Equals(methodName, StringComparison.Ordinal))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ ///
+ /// Prints the current stack trace to the specified .
+ ///
+ /// This is equivalent to Java's new Throwable().printStackTrace(destination)
+ /// or new Exception().printStackTrace(destination).
+ ///
+ /// The destination to write the stack trace to.
+ [MethodImpl(MethodImplOptions.NoInlining)] // Top frame is skipped, so we don't want to inline
+ public static void PrintCurrentStackTrace(TextWriter destination)
+ {
+ if (destination is null)
+ {
+ throw new ArgumentNullException(nameof(destination));
+ }
+
+ destination.WriteLine(new StackTrace(skipFrames: 1).ToString());
+ }
+ }
+}
diff --git a/src/Lucene.Net/Support/Text/StringExtensions.cs b/src/Lucene.Net/Support/Text/StringExtensions.cs
index eae0842233..dd72e3f29f 100644
--- a/src/Lucene.Net/Support/Text/StringExtensions.cs
+++ b/src/Lucene.Net/Support/Text/StringExtensions.cs
@@ -48,5 +48,26 @@ public static bool ContainsAny(this string input, char[] charsToCompare)
}
return false;
}
+
+#if !FEATURE_STRING_CONTAINS_STRINGCOMPARISON
+ ///
+ /// Returns true if contains
+ /// using the specified .
+ ///
+ /// The string in which to seek .
+ /// The string to check for.
+ /// The to use.
+ /// true if is found, otherwise; false.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool Contains(this string input, string value, StringComparison comparison)
+ {
+ if (input is null)
+ throw new ArgumentNullException(nameof(input));
+ if (value is null)
+ throw new ArgumentNullException(nameof(value));
+
+ return input.AsSpan().Contains(value.AsSpan(), comparison);
+ }
+#endif
}
}
diff --git a/src/Lucene.Net/Support/Util/ExceptionExtensions.cs b/src/Lucene.Net/Support/Util/ExceptionExtensions.cs
index 8528498cad..d62ccedd7a 100644
--- a/src/Lucene.Net/Support/Util/ExceptionExtensions.cs
+++ b/src/Lucene.Net/Support/Util/ExceptionExtensions.cs
@@ -1,8 +1,8 @@
using J2N.Collections.Generic.Extensions;
using System;
using System.Collections.Generic;
-using System.Linq;
using JCG = J2N.Collections.Generic;
+#nullable enable
namespace Lucene.Net.Util
{
@@ -46,12 +46,20 @@ public static IList GetSuppressedAsList(this Exception e)
}
else
{
- suppressed = e.Data[SUPPRESSED_EXCEPTIONS_KEY] as IList;
+ suppressed = e.Data[SUPPRESSED_EXCEPTIONS_KEY] as IList
+ ?? throw new InvalidOperationException($"Unexpected type for suppressed exceptions list: {e.Data[SUPPRESSED_EXCEPTIONS_KEY]?.GetType()}");
}
return suppressed;
}
+ public static IList? GetSuppressedAsListOrDefault(this Exception e)
+ {
+ return e.Data.Contains(SUPPRESSED_EXCEPTIONS_KEY)
+ ? e.Data[SUPPRESSED_EXCEPTIONS_KEY] as IList
+ : null;
+ }
+
public static void AddSuppressed(this Exception e, Exception exception)
{
e.GetSuppressedAsList().Add(exception);
diff --git a/src/Lucene.Net/Support/Util/SystemConsole.cs b/src/Lucene.Net/Support/Util/SystemConsole.cs
deleted file mode 100644
index 5dd841f565..0000000000
--- a/src/Lucene.Net/Support/Util/SystemConsole.cs
+++ /dev/null
@@ -1,411 +0,0 @@
-using System;
-using System.IO;
-using System.Runtime.CompilerServices;
-#if FEATURE_CODE_ACCESS_SECURITY
-using System.Security.Permissions;
-#endif
-
-namespace Lucene.Net.Util
-{
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
- ///
- /// Mimics , but allows for swapping
- /// the of
- /// and
- /// with user-defined implementations.
- ///
- public static class SystemConsole
- {
- public static TextWriter Out { get; set; } = TextWriter.Null;
- public static TextWriter Error { get; set; } = TextWriter.Null;
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(bool value)
- {
- Out.Write(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(char value)
- {
- Out.Write(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(char[] buffer)
- {
- Out.Write(buffer);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(decimal value)
- {
- Out.Write(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(double value)
- {
- Out.Write(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(int value)
- {
- Out.Write(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(long value)
- {
- Out.Write(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(object value)
- {
- Out.Write(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(float value)
- {
- Out.Write(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(string value)
- {
- Out.Write(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining), CLSCompliant(false)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(uint value)
- {
- Out.Write(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining), CLSCompliant(false)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(ulong value)
- {
- Out.Write(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(string format, object arg0)
- {
- Out.Write(format, arg0);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(string format, params object[] arg)
- {
- if (arg is null)
- {
- Out.Write(format, null, null);
- }
- else
- {
- Out.Write(format, arg);
- }
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(char[] buffer, int index, int count)
- {
- Out.Write(buffer, index, count);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(string format, object arg0, object arg1)
- {
- Out.Write(format, arg0, arg1);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(string format, object arg0, object arg1, object arg2)
- {
- Out.Write(format, arg0, arg1, arg2);
- }
-
-#if FEATURE_ARGITERATOR
- [MethodImpl(MethodImplOptions.NoInlining), CLSCompliant(false)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void Write(string format, object arg0, object arg1, object arg2, object arg3, __arglist)
- {
- ArgIterator iterator = new ArgIterator(__arglist);
- int num = iterator.GetRemainingCount() + 4;
- object[] arg = new object[num];
- arg[0] = arg0;
- arg[1] = arg1;
- arg[2] = arg2;
- arg[3] = arg3;
- for (int i = 4; i < num; i++)
- {
- arg[i] = TypedReference.ToObject(iterator.GetNextArg());
- }
- Out.Write(format, arg);
- }
-#endif
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine()
- {
- Out.WriteLine();
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(bool value)
- {
- Out.WriteLine(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(char value)
- {
- Out.WriteLine(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(char[] buffer)
- {
- Out.WriteLine(buffer);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(decimal value)
- {
- Out.WriteLine(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(double value)
- {
- Out.WriteLine(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(int value)
- {
- Out.WriteLine(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(long value)
- {
- Out.WriteLine(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(object value)
- {
- Out.WriteLine(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(float value)
- {
- Out.WriteLine(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(string value)
- {
- Out.WriteLine(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining), CLSCompliant(false)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(uint value)
- {
- Out.WriteLine(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining), CLSCompliant(false)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(ulong value)
- {
- Out.WriteLine(value);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(string format, object arg0)
- {
- Out.WriteLine(format, arg0);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(string format, params object[] arg)
- {
- if (arg is null)
- {
- Out.WriteLine(format, null, null);
- }
- else
- {
- Out.WriteLine(format, arg);
- }
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(char[] buffer, int index, int count)
- {
- Out.WriteLine(buffer, index, count);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(string format, object arg0, object arg1)
- {
- Out.WriteLine(format, arg0, arg1);
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(string format, object arg0, object arg1, object arg2)
- {
- Out.WriteLine(format, arg0, arg1, arg2);
- }
-
-#if FEATURE_ARGITERATOR
- [MethodImpl(MethodImplOptions.NoInlining), CLSCompliant(false)]
-#if FEATURE_CODE_ACCESS_SECURITY
- [HostProtection(SecurityAction.LinkDemand, UI = true)]
-#endif
- public static void WriteLine(string format, object arg0, object arg1, object arg2, object arg3, __arglist)
- {
- ArgIterator iterator = new ArgIterator(__arglist);
- int num = iterator.GetRemainingCount() + 4;
- object[] arg = new object[num];
- arg[0] = arg0;
- arg[1] = arg1;
- arg[2] = arg2;
- arg[3] = arg3;
- for (int i = 4; i < num; i++)
- {
- arg[i] = TypedReference.ToObject(iterator.GetNextArg());
- }
- Out.WriteLine(format, arg);
- }
-#endif
- }
-}
diff --git a/src/Lucene.Net/Util/Automaton/LevenshteinAutomata.cs b/src/Lucene.Net/Util/Automaton/LevenshteinAutomata.cs
index 48a8b1cd51..8ef25fd129 100644
--- a/src/Lucene.Net/Util/Automaton/LevenshteinAutomata.cs
+++ b/src/Lucene.Net/Util/Automaton/LevenshteinAutomata.cs
@@ -48,9 +48,9 @@ public class LevenshteinAutomata
/* the ranges outside of alphabet */
internal readonly int[] rangeLower;
internal readonly int[] rangeUpper;
- internal int numRanges = 0;
+ internal readonly int numRanges /*= 0*/; // LUCENENET: marked readonly
- internal ParametricDescription[] descriptions;
+ internal readonly ParametricDescription[] descriptions; // LUCENENET: marked readonly
///
/// Create a new for some string.
@@ -338,4 +338,4 @@ protected internal virtual int Unpack(long[] data, int index, int bitsPerValue)
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Util/Automaton/RegExp.cs b/src/Lucene.Net/Util/Automaton/RegExp.cs
index 1e7a6c975b..92c7bb5dc8 100644
--- a/src/Lucene.Net/Util/Automaton/RegExp.cs
+++ b/src/Lucene.Net/Util/Automaton/RegExp.cs
@@ -108,7 +108,7 @@ public enum RegExpSyntax
///
///
///
- ///
+ ///
///
/// unionexp
/// ::=
@@ -123,7 +123,7 @@ public enum RegExpSyntax
///
///
///
- ///
+ ///
///
/// interexp
/// ::=
@@ -138,7 +138,7 @@ public enum RegExpSyntax
///
///
///
- ///
+ ///
///
/// concatexp
/// ::=
@@ -153,7 +153,7 @@ public enum RegExpSyntax
///
///
///
- ///
+ ///
///
/// repeatexp
/// ::=
@@ -203,7 +203,7 @@ public enum RegExpSyntax
///
///
///
- ///
+ ///
///
/// complexp
/// ::=
@@ -218,7 +218,7 @@ public enum RegExpSyntax
///
///
///
- ///
+ ///
///
/// charclassexp
/// ::=
@@ -240,7 +240,7 @@ public enum RegExpSyntax
///
///
///
- ///
+ ///
///
/// charclasses
/// ::=
@@ -255,7 +255,7 @@ public enum RegExpSyntax
///
///
///
- ///
+ ///
///
/// charclass
/// ::=
@@ -270,7 +270,7 @@ public enum RegExpSyntax
///
///
///
- ///
+ ///
///
/// simpleexp
/// ::=
@@ -334,7 +334,7 @@ public enum RegExpSyntax
/// (numerical interval)
/// [OPTIONAL]
///
- ///
+ ///
///
/// charexp
/// ::=
@@ -349,9 +349,9 @@ public enum RegExpSyntax
/// (a single character)
///
///
- ///
+ ///
///
- ///
+ ///
///
/// The productions marked [OPTIONAL] are only allowed if
/// specified by the syntax flags passed to the constructor.
@@ -402,8 +402,8 @@ internal enum Kind
internal int min, max, digits;
internal int from, to;
- internal string b;
- internal RegExpSyntax flags;
+ internal readonly string b; // LUCENENET: marked readonly
+ internal readonly RegExpSyntax flags; // LUCENENET: marked readonly
internal int pos;
internal RegExp()
@@ -1336,4 +1336,4 @@ internal int ParseCharExp()
return Next();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Util/Automaton/SortedIntSet.cs b/src/Lucene.Net/Util/Automaton/SortedIntSet.cs
index 673a8fda5f..8fc175131f 100644
--- a/src/Lucene.Net/Util/Automaton/SortedIntSet.cs
+++ b/src/Lucene.Net/Util/Automaton/SortedIntSet.cs
@@ -264,9 +264,9 @@ public override string ToString()
///
public struct FrozenInt32Set : IEquatable
{
- internal int[] values;
- internal int hashCode;
- internal State state;
+ internal readonly int[] values; // LUCENENET: marked readonly
+ internal readonly int hashCode; // LUCENENET: marked readonly
+ internal readonly State state; // LUCENENET: marked readonly
public FrozenInt32Set(int[] values, int hashCode, State state)
{
@@ -353,4 +353,4 @@ public override string ToString()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Util/Automaton/State.cs b/src/Lucene.Net/Util/Automaton/State.cs
index ccc5ca5aff..20ea792de1 100644
--- a/src/Lucene.Net/Util/Automaton/State.cs
+++ b/src/Lucene.Net/Util/Automaton/State.cs
@@ -57,7 +57,7 @@ public class State : IComparable
internal int number;
- internal int id;
+ internal readonly int id; // LUCENENET: marked readonly
internal static int next_id;
///
diff --git a/src/Lucene.Net/Util/Automaton/StatePair.cs b/src/Lucene.Net/Util/Automaton/StatePair.cs
index 79d1e168ff..7775352f0d 100644
--- a/src/Lucene.Net/Util/Automaton/StatePair.cs
+++ b/src/Lucene.Net/Util/Automaton/StatePair.cs
@@ -39,8 +39,8 @@ namespace Lucene.Net.Util.Automaton
public class StatePair
{
internal State s;
- internal State s1;
- internal State s2;
+ internal readonly State s1; // LUCENENET: marked readonly
+ internal readonly State s2; // LUCENENET: marked readonly
internal StatePair(State s, State s1, State s2)
{
diff --git a/src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs b/src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs
index c5c8c84bf1..208c15d061 100644
--- a/src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs
+++ b/src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs
@@ -392,4 +392,4 @@ private State NewUTF8State()
return s;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Util/CollectionUtil.cs b/src/Lucene.Net/Util/CollectionUtil.cs
index 71c548096c..95d443b168 100644
--- a/src/Lucene.Net/Util/CollectionUtil.cs
+++ b/src/Lucene.Net/Util/CollectionUtil.cs
@@ -34,7 +34,7 @@ public static class CollectionUtil // LUCENENET specific - made static
private sealed class ListIntroSorter : IntroSorter
{
internal T pivot;
- internal IList list;
+ internal readonly IList list; // LUCENENET: marked readonly
internal readonly IComparer comp;
internal ListIntroSorter(IList list, IComparer comp)
@@ -45,7 +45,7 @@ internal ListIntroSorter(IList list, IComparer comp)
//{
// throw new ArgumentException("CollectionUtil can only sort random access lists in-place.");
//}
-
+
this.list = list;
this.comp = comp;
}
@@ -77,7 +77,7 @@ protected override int ComparePivot(int j)
private sealed class ListTimSorter : TimSorter
{
- internal IList list;
+ internal readonly IList list; // LUCENENET: marked readonly
internal readonly IComparer comp;
internal readonly T[] tmp;
@@ -144,7 +144,7 @@ protected override int CompareSaved(int i, int j)
///
/// Sorts the given using the .
/// This method uses the intro sort
- /// algorithm, but falls back to insertion sort for small lists.
+ /// algorithm, but falls back to insertion sort for small lists.
///
/// This
/// The to use for the sort.
@@ -161,7 +161,7 @@ public static void IntroSort(IList list, IComparer comp)
///
/// Sorts the given random access in natural order.
/// This method uses the intro sort
- /// algorithm, but falls back to insertion sort for small lists.
+ /// algorithm, but falls back to insertion sort for small lists.
///
/// This
public static void IntroSort(IList list)
@@ -211,4 +211,4 @@ public static void TimSort(IList list)
TimSort(list, ArrayUtil.GetNaturalComparer());
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Util/IndexableBinaryStringTools.cs b/src/Lucene.Net/Util/IndexableBinaryStringTools.cs
index 68e8f5c122..c63632fcbd 100644
--- a/src/Lucene.Net/Util/IndexableBinaryStringTools.cs
+++ b/src/Lucene.Net/Util/IndexableBinaryStringTools.cs
@@ -299,8 +299,8 @@ public static void Decode(char[] inputArray, int inputOffset, int inputLength, s
internal class CodingCase
{
- internal int numBytes, initialShift, middleShift, finalShift, advanceBytes = 2;
- internal short middleMask, finalMask;
+ internal readonly int numBytes, initialShift, middleShift, finalShift, advanceBytes = 2; // LUCENENET: marked readonly
+ internal readonly short middleMask, finalMask; // LUCENENET: marked readonly
internal CodingCase(int initialShift, int middleShift, int finalShift)
{
diff --git a/src/Lucene.Net/Util/Packed/AbstractAppendingLongBuffer.cs b/src/Lucene.Net/Util/Packed/AbstractAppendingLongBuffer.cs
index 61578feb4c..64d10bb0c2 100644
--- a/src/Lucene.Net/Util/Packed/AbstractAppendingLongBuffer.cs
+++ b/src/Lucene.Net/Util/Packed/AbstractAppendingLongBuffer.cs
@@ -22,7 +22,7 @@ namespace Lucene.Net.Util.Packed
*/
///
- /// Common functionality shared by and .
+ /// Common functionality shared by and .
///
/// NOTE: This was AbstractAppendingLongBuffer in Lucene
///
@@ -40,7 +40,7 @@ public abstract class AbstractAppendingInt64Buffer : Int64Values // LUCENENET NO
internal int valuesOff;
internal long[] pending;
internal int pendingOff;
- internal float acceptableOverheadRatio;
+ internal readonly float acceptableOverheadRatio; // LUCENENET: marked readonly
private protected AbstractAppendingInt64Buffer(int initialBlockCount, int pageSize, float acceptableOverheadRatio) // LUCENENET: Changed from internal to private protected
{
@@ -142,7 +142,7 @@ public int Get(long index, long[] arr, int off, int len)
internal abstract int Get(int block, int element, long[] arr, int off, int len);
///
- /// Return an iterator over the values of this buffer.
+ /// Return an iterator over the values of this buffer.
///
public virtual Iterator GetIterator()
{
@@ -220,11 +220,11 @@ public long Next()
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal virtual long BaseRamBytesUsed()
{
- return RamUsageEstimator.NUM_BYTES_OBJECT_HEADER
- + 2 * RamUsageEstimator.NUM_BYTES_OBJECT_REF
- + 2 * RamUsageEstimator.NUM_BYTES_INT32
- + 2 * RamUsageEstimator.NUM_BYTES_INT32
- + RamUsageEstimator.NUM_BYTES_SINGLE
+ return RamUsageEstimator.NUM_BYTES_OBJECT_HEADER
+ + 2 * RamUsageEstimator.NUM_BYTES_OBJECT_REF
+ + 2 * RamUsageEstimator.NUM_BYTES_INT32
+ + 2 * RamUsageEstimator.NUM_BYTES_INT32
+ + RamUsageEstimator.NUM_BYTES_SINGLE
+ RamUsageEstimator.NUM_BYTES_INT64; // valuesBytes - acceptable overhead - pageShift, pageMask - the 2 offsets - the 2 arrays
}
@@ -256,4 +256,4 @@ public virtual void Freeze()
pending = null;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Util/PrintStreamInfoStream.cs b/src/Lucene.Net/Util/PrintStreamInfoStream.cs
index 451586e7f6..804d01e507 100644
--- a/src/Lucene.Net/Util/PrintStreamInfoStream.cs
+++ b/src/Lucene.Net/Util/PrintStreamInfoStream.cs
@@ -4,7 +4,6 @@
using System.IO;
using System.Runtime.CompilerServices;
using System.Threading;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Util
{
@@ -95,4 +94,4 @@ protected override void Dispose(bool disposing)
public virtual bool IsSystemStream => isSystemStream;
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Util/PriorityQueue.cs b/src/Lucene.Net/Util/PriorityQueue.cs
index 6f3e680b55..5f3f74e97d 100644
--- a/src/Lucene.Net/Util/PriorityQueue.cs
+++ b/src/Lucene.Net/Util/PriorityQueue.cs
@@ -128,6 +128,7 @@ public abstract class PriorityComparer : IComparer
///
/// @lucene.internal
///
+ [SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
public ref struct ValuePriorityQueue
{
private int size;
diff --git a/src/Lucene.Net/Util/RollingBuffer.cs b/src/Lucene.Net/Util/RollingBuffer.cs
index 519646e039..93f0e10e48 100644
--- a/src/Lucene.Net/Util/RollingBuffer.cs
+++ b/src/Lucene.Net/Util/RollingBuffer.cs
@@ -72,7 +72,7 @@ public abstract class RollingBuffer
// How many valid Position are held in the
// array:
private int count;
- private IRollingBufferItemFactory itemFactory;
+ private readonly IRollingBufferItemFactory itemFactory; // LUCENENET: marked readonly
protected RollingBuffer(IRollingBufferItemFactory itemFactory)
{
@@ -187,4 +187,4 @@ public virtual void FreeBefore(int pos)
count -= toFree;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Util/TimSorter.cs b/src/Lucene.Net/Util/TimSorter.cs
index bbc9525d8a..35553b3362 100644
--- a/src/Lucene.Net/Util/TimSorter.cs
+++ b/src/Lucene.Net/Util/TimSorter.cs
@@ -52,7 +52,7 @@ public abstract class TimSorter : Sorter
internal int minRun;
internal int to;
internal int stackSize;
- internal int[] runEnds;
+ internal readonly int[] runEnds; // LUCENENET: marked readonly
///
/// Create a new .
diff --git a/src/dotnet/tools/lucene-cli/CommandLine/CommandLineApplication.cs b/src/dotnet/tools/lucene-cli/CommandLine/CommandLineApplication.cs
index 0b920e1adc..4886bd170e 100644
--- a/src/dotnet/tools/lucene-cli/CommandLine/CommandLineApplication.cs
+++ b/src/dotnet/tools/lucene-cli/CommandLine/CommandLineApplication.cs
@@ -9,7 +9,6 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Cli.CommandLine
{
@@ -570,4 +569,4 @@ public void Reset()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/dotnet/tools/lucene-cli/Program.cs b/src/dotnet/tools/lucene-cli/Program.cs
index 77c548f4ff..529018f0d5 100644
--- a/src/dotnet/tools/lucene-cli/Program.cs
+++ b/src/dotnet/tools/lucene-cli/Program.cs
@@ -25,10 +25,6 @@ public static class Program
{
public static int Main(string[] args)
{
- // Enable console output
- SystemConsole.Out = Console.Out;
- SystemConsole.Error = Console.Error;
-
var configuration = new ConfigurationBuilder()
.AddEnvironmentVariables(prefix: "lucene:") // Use a custom prefix to only load Lucene.NET settings
.AddJsonFile("appsettings.json", optional: true)