You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/03/15 23:50:13 UTC
[31/50] [abbrv] lucenenet git commit: SWEEP: Changed remaining string
StartsWith() and EndsWith() statements to use StringComparison.Ordinal
SWEEP: Changed remaining string StartsWith() and EndsWith() statements to use StringComparison.Ordinal
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/e61076ab
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/e61076ab
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/e61076ab
Branch: refs/heads/api-work
Commit: e61076ab390a321851562520982ba1f651d86749
Parents: 24e28a7
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 15 15:11:17 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Wed Mar 15 16:03:36 2017 +0700
----------------------------------------------------------------------
.../Analysis/Synonym/SlowSynonymFilterFactory.cs | 2 +-
.../Analysis/Synonym/SolrSynonymParser.cs | 2 +-
.../Analysis/Util/AnalysisSPILoader.cs | 2 +-
.../Analyzing/AnalyzingQueryParser.cs | 3 ++-
src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs | 4 ++--
.../Analysis/Hunspell/TestDictionary.cs | 4 ++--
.../Classic/TestQueryParser.cs | 2 +-
.../Suggest/Analyzing/FuzzySuggesterTest.cs | 4 ++--
.../Suggest/Analyzing/TestFreeTextSuggester.cs | 2 +-
.../Suggest/Fst/FSTCompletionTest.cs | 2 +-
src/Lucene.Net.Tests/Analysis/TestNumericTokenStream.cs | 4 ++--
.../Compressing/TestCompressingStoredFieldsFormat.cs | 2 +-
src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs | 2 +-
.../Index/TestAllFilesHaveChecksumFooter.cs | 2 +-
src/Lucene.Net.Tests/Index/TestAllFilesHaveCodecHeader.cs | 2 +-
src/Lucene.Net.Tests/Index/TestCodecs.cs | 2 +-
src/Lucene.Net.Tests/Index/TestIndexInput.cs | 4 ++--
src/Lucene.Net.Tests/Index/TestIndexWriter.cs | 2 +-
src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs | 9 +++++----
src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs | 10 +++++-----
src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs | 2 +-
src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs | 2 +-
src/Lucene.Net.Tests/Index/TestLazyProxSkipping.cs | 3 ++-
src/Lucene.Net.Tests/Index/TestMultiLevelSkipList.cs | 3 ++-
src/Lucene.Net.Tests/Index/TestOmitNorms.cs | 8 ++++----
src/Lucene.Net.Tests/Index/TestOmitPositions.cs | 10 +++++-----
src/Lucene.Net.Tests/Index/TestOmitTf.cs | 4 ++--
src/Lucene.Net.Tests/Index/TestParallelCompositeReader.cs | 4 ++--
src/Lucene.Net.Tests/Index/TestPayloads.cs | 2 +-
.../Index/TestPersistentSnapshotDeletionPolicy.cs | 2 +-
src/Lucene.Net.Tests/Index/TestPostingsOffsets.cs | 4 ++--
src/Lucene.Net.Tests/Index/TestReaderClosed.cs | 3 ++-
src/Lucene.Net.Tests/Index/TestRollingUpdates.cs | 2 +-
src/Lucene.Net.Tests/Index/TestTransactionRollback.cs | 2 +-
src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs | 4 ++--
src/Lucene.Net.Tests/Search/TestPhrasePrefixQuery.cs | 3 ++-
src/Lucene.Net.Tests/Search/TestTopFieldCollector.cs | 6 ++++--
src/Lucene.Net.Tests/Support/TestByteBuffer.cs | 2 +-
src/Lucene.Net.Tests/Support/TestLongBuffer.cs | 2 +-
src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs | 2 +-
src/Lucene.Net.Tests/Util/TestConstants.cs | 4 ++--
src/Lucene.Net.Tests/Util/TestWeakIdentityMap.cs | 2 +-
42 files changed, 75 insertions(+), 67 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilterFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilterFactory.cs
index a089173..6775edd 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilterFactory.cs
@@ -317,7 +317,7 @@ namespace Lucene.Net.Analysis.Synonym
while (pos < end)
{
//if (s.StartsWith(separator,pos))
- if (s.Substring(pos).StartsWith(separator))
+ if (s.Substring(pos).StartsWith(separator, StringComparison.Ordinal))
{
if (sb.Length > 0)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SolrSynonymParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SolrSynonymParser.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SolrSynonymParser.cs
index cd13921..7016143 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SolrSynonymParser.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SolrSynonymParser.cs
@@ -153,7 +153,7 @@ namespace Lucene.Net.Analysis.Synonym
while (pos < end)
{
//if (s.StartsWith(separator, pos))
- if (s.Substring(pos).StartsWith(separator))
+ if (s.Substring(pos).StartsWith(separator, StringComparison.Ordinal))
{
if (sb.Length > 0)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs
index c8502e6..5d98993 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs
@@ -68,7 +68,7 @@ namespace Lucene.Net.Analysis.Util
string name = null;
foreach (string suffix in suffixes)
{
- if (clazzName.EndsWith(suffix))
+ if (clazzName.EndsWith(suffix, StringComparison.Ordinal))
{
name = clazzName.Substring(0, clazzName.Length - suffix.Length).ToLowerInvariant();
break;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.QueryParser/Analyzing/AnalyzingQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Analyzing/AnalyzingQueryParser.cs b/src/Lucene.Net.QueryParser/Analyzing/AnalyzingQueryParser.cs
index d1bbec2..25b869a 100644
--- a/src/Lucene.Net.QueryParser/Analyzing/AnalyzingQueryParser.cs
+++ b/src/Lucene.Net.QueryParser/Analyzing/AnalyzingQueryParser.cs
@@ -3,6 +3,7 @@ using Lucene.Net.Analysis.TokenAttributes;
using Lucene.Net.QueryParsers.Classic;
using Lucene.Net.Search;
using Lucene.Net.Util;
+using System;
using System.Text;
using System.Text.RegularExpressions;
@@ -70,7 +71,7 @@ namespace Lucene.Net.QueryParsers.Analyzing
//can't imagine this would ever happen
throw new ParseException("Passed null value as term to GetWildcardQuery");
}
- if (!AllowLeadingWildcard && (termStr.StartsWith("*") || termStr.StartsWith("?")))
+ if (!AllowLeadingWildcard && (termStr.StartsWith("*", StringComparison.Ordinal) || termStr.StartsWith("?", StringComparison.Ordinal)))
{
throw new ParseException("'*' or '?' not allowed as first character in WildcardQuery"
+ " unless AllowLeadingWildcard returns true");
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs b/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs
index 4599e43..1e064cf 100644
--- a/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs
+++ b/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs
@@ -712,7 +712,7 @@ namespace Lucene.Net.QueryParsers.Classic
{
if ("*".Equals(termStr)) return NewMatchAllDocsQuery();
}
- if (!AllowLeadingWildcard && (termStr.StartsWith("*") || termStr.StartsWith("?")))
+ if (!AllowLeadingWildcard && (termStr.StartsWith("*", StringComparison.Ordinal) || termStr.StartsWith("?", StringComparison.Ordinal)))
throw new ParseException("'*' or '?' not allowed as first character in WildcardQuery");
if (LowercaseExpandedTerms)
{
@@ -772,7 +772,7 @@ namespace Lucene.Net.QueryParsers.Classic
/// <returns>Resulting <see cref="Query"/> built for the term</returns>
protected internal virtual Query GetPrefixQuery(string field, string termStr)
{
- if (!AllowLeadingWildcard && termStr.StartsWith("*"))
+ if (!AllowLeadingWildcard && termStr.StartsWith("*", StringComparison.Ordinal))
throw new ParseException("'*' not allowed as first character in PrefixQuery");
if (LowercaseExpandedTerms)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestDictionary.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestDictionary.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestDictionary.cs
index 44bc82e..083db5e 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestDictionary.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestDictionary.cs
@@ -134,7 +134,7 @@ namespace Lucene.Net.Analysis.Hunspell
}
catch (Exception expected)
{
- assertTrue(expected.Message.StartsWith("The affix file contains a rule with less than four elements"));
+ assertTrue(expected.Message.StartsWith("The affix file contains a rule with less than four elements", StringComparison.Ordinal));
//assertEquals(24, expected.ErrorOffset); // No parse exception in LUCENENET
}
}
@@ -156,7 +156,7 @@ namespace Lucene.Net.Analysis.Hunspell
}
catch (Exception expected)
{
- assertTrue(expected.Message.StartsWith("expected only one flag"));
+ assertTrue(expected.Message.StartsWith("expected only one flag", StringComparison.Ordinal));
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs
index 2db6fa2..5fc0517 100644
--- a/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs
@@ -171,7 +171,7 @@ namespace Lucene.Net.QueryParsers.Classic
internal override Query HandleBareFuzzy(string qfield, Token fuzzySlop, string termImage)
{
- if (fuzzySlop.Image.EndsWith("\u20ac"))
+ if (fuzzySlop.Image.EndsWith("\u20ac", StringComparison.Ordinal))
{
float fms = FuzzyMinSim;
try
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs
index 8491df7..96494cd 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs
@@ -846,7 +846,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
for (int i = 0; i < tokens.Length; i++)
{
string token = tokens[i];
- if (preserveSep && builder.Length > 0 && !builder.ToString().EndsWith(" "))
+ if (preserveSep && builder.Length > 0 && !builder.ToString().EndsWith(" ", StringComparison.Ordinal))
{
builder.Append(' ');
}
@@ -889,7 +889,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
continue;
}
- if (preserveSep && (prefix.EndsWith(" ") || lastRemoved))
+ if (preserveSep && (prefix.EndsWith(" ", StringComparison.Ordinal) || lastRemoved))
{
analyzedKey += " ";
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
index 53d90c7..de9a8f7 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
@@ -657,7 +657,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
List<Lookup.LookupResult> tmp = new List<Lookup.LookupResult>();
foreach (string term in terms)
{
- if (term.StartsWith(tokens[tokens.Length - 1]))
+ if (term.StartsWith(tokens[tokens.Length - 1], StringComparison.Ordinal))
{
if (VERBOSE)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs
index 69ab50b..6ef263c 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs
@@ -252,7 +252,7 @@ namespace Lucene.Net.Search.Suggest.Fst
String prefix = term.Substring(0, i - 0);
foreach (Lookup.LookupResult lr in lookup.DoLookup(StringToCharSequence(prefix).ToString(), true, 10))
{
- assertTrue(lr.Key.toString().StartsWith(prefix));
+ assertTrue(lr.Key.toString().StartsWith(prefix, StringComparison.Ordinal));
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Analysis/TestNumericTokenStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Analysis/TestNumericTokenStream.cs b/src/Lucene.Net.Tests/Analysis/TestNumericTokenStream.cs
index 8c020e4..19c0dc6 100644
--- a/src/Lucene.Net.Tests/Analysis/TestNumericTokenStream.cs
+++ b/src/Lucene.Net.Tests/Analysis/TestNumericTokenStream.cs
@@ -128,7 +128,7 @@ namespace Lucene.Net.Analysis
}
catch (System.ArgumentException iae)
{
- Assert.IsTrue(iae.Message.StartsWith("NumericTokenStream does not support"));
+ Assert.IsTrue(iae.Message.StartsWith("NumericTokenStream does not support", StringComparison.Ordinal));
}
try
{
@@ -137,7 +137,7 @@ namespace Lucene.Net.Analysis
}
catch (System.ArgumentException iae)
{
- Assert.IsTrue(iae.Message.StartsWith("NumericTokenStream does not support"));
+ Assert.IsTrue(iae.Message.StartsWith("NumericTokenStream does not support", StringComparison.Ordinal));
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs b/src/Lucene.Net.Tests/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
index ab6204e..3adfebf 100644
--- a/src/Lucene.Net.Tests/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
+++ b/src/Lucene.Net.Tests/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
@@ -82,7 +82,7 @@ namespace Lucene.Net.Codecs.Compressing
int counter = 0;
foreach (string fileName in dir.ListAll())
{
- if (fileName.EndsWith(".fdt") || fileName.EndsWith(".fdx"))
+ if (fileName.EndsWith(".fdt", StringComparison.Ordinal) || fileName.EndsWith(".fdx", StringComparison.Ordinal))
{
counter++;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs b/src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs
index dbb1303..e1a56df 100644
--- a/src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs
+++ b/src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs
@@ -98,7 +98,7 @@ namespace Lucene.Net.Index
bool found = false;
foreach (string file in dir.ListAll())
{
- if (file.EndsWith(".fdt"))
+ if (file.EndsWith(".fdt", StringComparison.Ordinal))
{
long fileLength = dir.FileLength(file);
if (fileLength >= 1L << 32)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestAllFilesHaveChecksumFooter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestAllFilesHaveChecksumFooter.cs b/src/Lucene.Net.Tests/Index/TestAllFilesHaveChecksumFooter.cs
index f099ac7..9267a8a 100644
--- a/src/Lucene.Net.Tests/Index/TestAllFilesHaveChecksumFooter.cs
+++ b/src/Lucene.Net.Tests/Index/TestAllFilesHaveChecksumFooter.cs
@@ -84,7 +84,7 @@ namespace Lucene.Net.Index
{
continue; // write.lock has no footer, thats ok
}
- if (file.EndsWith(IndexFileNames.COMPOUND_FILE_EXTENSION))
+ if (file.EndsWith(IndexFileNames.COMPOUND_FILE_EXTENSION, StringComparison.Ordinal))
{
CompoundFileDirectory cfsDir = new CompoundFileDirectory(dir, file, NewIOContext(Random()), false);
CheckHeaders(cfsDir); // recurse into cfs
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestAllFilesHaveCodecHeader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestAllFilesHaveCodecHeader.cs b/src/Lucene.Net.Tests/Index/TestAllFilesHaveCodecHeader.cs
index eeeab8b..e142ad0 100644
--- a/src/Lucene.Net.Tests/Index/TestAllFilesHaveCodecHeader.cs
+++ b/src/Lucene.Net.Tests/Index/TestAllFilesHaveCodecHeader.cs
@@ -88,7 +88,7 @@ namespace Lucene.Net.Index
{
continue; // segments.gen has no header, thats ok
}
- if (file.EndsWith(IndexFileNames.COMPOUND_FILE_EXTENSION))
+ if (file.EndsWith(IndexFileNames.COMPOUND_FILE_EXTENSION, StringComparison.Ordinal))
{
CompoundFileDirectory cfsDir = new CompoundFileDirectory(dir, file, NewIOContext(Random()), false);
CheckHeaders(cfsDir); // recurse into cfs
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestCodecs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestCodecs.cs b/src/Lucene.Net.Tests/Index/TestCodecs.cs
index 24a3e7c..fc4c1fe 100644
--- a/src/Lucene.Net.Tests/Index/TestCodecs.cs
+++ b/src/Lucene.Net.Tests/Index/TestCodecs.cs
@@ -316,7 +316,7 @@ namespace Lucene.Net.Index
while (true)
{
text2 = TestUtil.RandomUnicodeString(Random());
- if (!termsSeen.Contains(text2) && !text2.EndsWith("."))
+ if (!termsSeen.Contains(text2) && !text2.EndsWith(".", StringComparison.Ordinal))
{
termsSeen.Add(text2);
break;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestIndexInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexInput.cs b/src/Lucene.Net.Tests/Index/TestIndexInput.cs
index a2ffea1..6068f2c 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexInput.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexInput.cs
@@ -114,7 +114,7 @@ namespace Lucene.Net.Index
}
catch (Exception e)
{
- Assert.IsTrue(e.Message.StartsWith("Invalid vInt"));
+ Assert.IsTrue(e.Message.StartsWith("Invalid vInt", StringComparison.Ordinal));
Assert.IsTrue(expectedEx.IsInstanceOfType(e));
}
Assert.AreEqual(1, @is.ReadVInt32()); // guard value
@@ -126,7 +126,7 @@ namespace Lucene.Net.Index
}
catch (Exception e)
{
- Assert.IsTrue(e.Message.StartsWith("Invalid vLong"));
+ Assert.IsTrue(e.Message.StartsWith("Invalid vLong", StringComparison.Ordinal));
Assert.IsTrue(expectedEx.IsInstanceOfType(e));
}
Assert.AreEqual(1L, @is.ReadVInt64()); // guard value
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
index 3636a1e..06a8861 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
@@ -1766,7 +1766,7 @@ namespace Lucene.Net.Index
int extraFileCount;
if (files.Length == 1)
{
- Assert.IsTrue(files[0].EndsWith("write.lock"));
+ Assert.IsTrue(files[0].EndsWith("write.lock", StringComparison.Ordinal));
extraFileCount = 1;
}
else
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs
index 5dee468..52c330e 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs
@@ -1,6 +1,7 @@
using Lucene.Net.Documents;
using Lucene.Net.Support;
using Lucene.Net.Util;
+using System;
using System.Collections.Generic;
using System.Reflection;
@@ -116,7 +117,7 @@ namespace Lucene.Net.Index
foreach (MethodInfo m in typeof(IndexWriterConfig).GetMethods())
{
- if (m.DeclaringType == typeof(IndexWriterConfig) && m.Name.StartsWith("get") && !m.Name.StartsWith("get_"))
+ if (m.DeclaringType == typeof(IndexWriterConfig) && m.Name.StartsWith("get", StringComparison.Ordinal) && !m.Name.StartsWith("get_", StringComparison.Ordinal))
{
Assert.IsTrue(getters.Contains(m.Name), "method " + m.Name + " is not tested for defaults");
}
@@ -131,7 +132,7 @@ namespace Lucene.Net.Index
HashSet<string> allSetters = new HashSet<string>();
foreach (MethodInfo m in typeof(IndexWriterConfig).GetMethods())
{
- if (m.Name.StartsWith("Set") && !m.IsStatic)
+ if (m.Name.StartsWith("Set", StringComparison.Ordinal) && !m.IsStatic)
{
allSetters.Add(m.Name);
// setters overridden from LiveIndexWriterConfig are returned twice, once with
@@ -206,7 +207,7 @@ namespace Lucene.Net.Index
HashSet<string> liveGetters = new HashSet<string>();
foreach (MethodInfo m in typeof(LiveIndexWriterConfig).GetMethods())
{
- if (m.Name.StartsWith("get") && !m.IsStatic)
+ if (m.Name.StartsWith("get", StringComparison.Ordinal) && !m.IsStatic)
{
liveGetters.Add(m.Name);
}
@@ -214,7 +215,7 @@ namespace Lucene.Net.Index
foreach (MethodInfo m in typeof(IndexWriterConfig).GetMethods())
{
- if (m.Name.StartsWith("get") && !m.Name.StartsWith("get_") && !m.IsStatic)
+ if (m.Name.StartsWith("get", StringComparison.Ordinal) && !m.Name.StartsWith("get_", StringComparison.Ordinal) && !m.IsStatic)
{
Assert.AreEqual(typeof(IndexWriterConfig), m.DeclaringType, "method " + m.Name + " not overrided by IndexWriterConfig");
Assert.IsTrue(liveGetters.Contains(m.Name), "method " + m.Name + " not declared on LiveIndexWriterConfig");
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
index 82ea977..dd6cbb5 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
@@ -1308,7 +1308,7 @@ namespace Lucene.Net.Index
public override void Message(string component, string message)
{
- if (message.StartsWith("now flush at close") && Thrown.CompareAndSet(false, true))
+ if (message.StartsWith("now flush at close", StringComparison.Ordinal) && Thrown.CompareAndSet(false, true))
{
throw new System.OutOfMemoryException("fake OOME at " + message);
}
@@ -1501,7 +1501,7 @@ namespace Lucene.Net.Index
bool corrupted = false;
for (int i = 0; i < files.Length; i++)
{
- if (files[i].EndsWith(".cfs"))
+ if (files[i].EndsWith(".cfs", StringComparison.Ordinal))
{
dir.DeleteFile(files[i]);
corrupted = true;
@@ -1632,7 +1632,7 @@ namespace Lucene.Net.Index
}
catch (Exception e)
{
- Assert.IsTrue(e.Message.StartsWith(FailOnTermVectors.EXC_MSG));
+ Assert.IsTrue(e.Message.StartsWith(FailOnTermVectors.EXC_MSG, StringComparison.Ordinal));
}
if (Random().Next(20) == 0)
{
@@ -1657,7 +1657,7 @@ namespace Lucene.Net.Index
}
catch (Exception e)
{
- Assert.IsTrue(e.Message.StartsWith(FailOnTermVectors.EXC_MSG));
+ Assert.IsTrue(e.Message.StartsWith(FailOnTermVectors.EXC_MSG, StringComparison.Ordinal));
}
if (Random().Next(20) == 0)
{
@@ -1869,7 +1869,7 @@ namespace Lucene.Net.Index
public override IndexInput OpenInput(string name, IOContext context)
{
if (DoFail
- && name.StartsWith("segments_")
+ && name.StartsWith("segments_", StringComparison.Ordinal)
&& StackTraceHelper.DoesStackTraceContainMethod("Read"))
{
throw new NotSupportedException("expected UOE");
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs
index 4254df5..2e07df5 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs
@@ -242,7 +242,7 @@
// public virtual void CrashJRE()
// {
// string vendor = Constants.JAVA_VENDOR;
-// bool supportsUnsafeNpeDereference = vendor.StartsWith("Oracle") || vendor.StartsWith("Sun") || vendor.StartsWith("Apple");
+// bool supportsUnsafeNpeDereference = vendor.StartsWith("Oracle", StringComparison.Ordinal) || vendor.StartsWith("Sun", StringComparison.Ordinal) || vendor.StartsWith("Apple", StringComparison.Ordinal);
// try
// {
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
index a1c70d5..d805620 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
@@ -108,7 +108,7 @@ namespace Lucene.Net.Index
}
//System.out.println(Thread.currentThread().getName() + ": hit exc");
//ioConsole.WriteLine(e.StackTrace);
- if (ioe.Message.StartsWith("fake disk full at") || ioe.Message.Equals("now failing on purpose"))
+ if (ioe.Message.StartsWith("fake disk full at", StringComparison.Ordinal) || ioe.Message.Equals("now failing on purpose", StringComparison.Ordinal))
{
DiskFull = true;
#if !NETSTANDARD
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestLazyProxSkipping.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestLazyProxSkipping.cs b/src/Lucene.Net.Tests/Index/TestLazyProxSkipping.cs
index 48e3346..c8a75b4 100644
--- a/src/Lucene.Net.Tests/Index/TestLazyProxSkipping.cs
+++ b/src/Lucene.Net.Tests/Index/TestLazyProxSkipping.cs
@@ -1,4 +1,5 @@
using Lucene.Net.Support;
+using System;
namespace Lucene.Net.Index
{
@@ -63,7 +64,7 @@ namespace Lucene.Net.Index
public override IndexInput OpenInput(string name, IOContext context)
{
IndexInput ii = base.OpenInput(name, context);
- if (name.EndsWith(".prx") || name.EndsWith(".pos"))
+ if (name.EndsWith(".prx", StringComparison.Ordinal) || name.EndsWith(".pos", StringComparison.Ordinal))
{
// we decorate the proxStream with a wrapper class that allows to count the number of calls of seek()
ii = new SeeksCountingStream(OuterInstance, ii);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestMultiLevelSkipList.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestMultiLevelSkipList.cs b/src/Lucene.Net.Tests/Index/TestMultiLevelSkipList.cs
index 9ee8ef8..db06ba7 100644
--- a/src/Lucene.Net.Tests/Index/TestMultiLevelSkipList.cs
+++ b/src/Lucene.Net.Tests/Index/TestMultiLevelSkipList.cs
@@ -1,5 +1,6 @@
using Lucene.Net.Analysis.TokenAttributes;
using Lucene.Net.Documents;
+using System;
namespace Lucene.Net.Index
{
@@ -60,7 +61,7 @@ namespace Lucene.Net.Index
public override IndexInput OpenInput(string fileName, IOContext context)
{
IndexInput @in = base.OpenInput(fileName, context);
- if (fileName.EndsWith(".frq"))
+ if (fileName.EndsWith(".frq", StringComparison.Ordinal))
{
@in = new CountingStream(OuterInstance, @in);
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestOmitNorms.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestOmitNorms.cs b/src/Lucene.Net.Tests/Index/TestOmitNorms.cs
index c660ac8..9d0b2a3 100644
--- a/src/Lucene.Net.Tests/Index/TestOmitNorms.cs
+++ b/src/Lucene.Net.Tests/Index/TestOmitNorms.cs
@@ -1,11 +1,11 @@
+using NUnit.Framework;
using Lucene.Net.Documents;
+using Lucene.Net.Randomized.Generators;
using Lucene.Net.Support;
+using System;
namespace Lucene.Net.Index
{
- using Lucene.Net.Randomized.Generators;
- using NUnit.Framework;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -189,7 +189,7 @@ namespace Lucene.Net.Index
for (int i = 0; i < files.Length; i++)
{
// TODO: this relies upon filenames
- Assert.IsFalse(files[i].EndsWith(".nrm") || files[i].EndsWith(".len"));
+ Assert.IsFalse(files[i].EndsWith(".nrm", StringComparison.Ordinal) || files[i].EndsWith(".len", StringComparison.Ordinal));
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestOmitPositions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestOmitPositions.cs b/src/Lucene.Net.Tests/Index/TestOmitPositions.cs
index eec7785..83ad54d 100644
--- a/src/Lucene.Net.Tests/Index/TestOmitPositions.cs
+++ b/src/Lucene.Net.Tests/Index/TestOmitPositions.cs
@@ -1,11 +1,11 @@
+using NUnit.Framework;
using Lucene.Net.Documents;
+using Lucene.Net.Randomized.Generators;
using Lucene.Net.Support;
+using System;
namespace Lucene.Net.Index
{
- using Lucene.Net.Randomized.Generators;
- using NUnit.Framework;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -195,8 +195,8 @@ namespace Lucene.Net.Index
string[] files = dir.ListAll();
for (int i = 0; i < files.Length; i++)
{
- Assert.IsFalse(files[i].EndsWith(".prx"));
- Assert.IsFalse(files[i].EndsWith(".pos"));
+ Assert.IsFalse(files[i].EndsWith(".prx", StringComparison.Ordinal));
+ Assert.IsFalse(files[i].EndsWith(".pos", StringComparison.Ordinal));
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestOmitTf.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestOmitTf.cs b/src/Lucene.Net.Tests/Index/TestOmitTf.cs
index 4e8159d..27aa52a 100644
--- a/src/Lucene.Net.Tests/Index/TestOmitTf.cs
+++ b/src/Lucene.Net.Tests/Index/TestOmitTf.cs
@@ -258,8 +258,8 @@ namespace Lucene.Net.Index
string[] files = dir.ListAll();
for (int i = 0; i < files.Length; i++)
{
- Assert.IsFalse(files[i].EndsWith(".prx"));
- Assert.IsFalse(files[i].EndsWith(".pos"));
+ Assert.IsFalse(files[i].EndsWith(".prx", StringComparison.Ordinal));
+ Assert.IsFalse(files[i].EndsWith(".pos", StringComparison.Ordinal));
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestParallelCompositeReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestParallelCompositeReader.cs b/src/Lucene.Net.Tests/Index/TestParallelCompositeReader.cs
index b726a6a..06559f4 100644
--- a/src/Lucene.Net.Tests/Index/TestParallelCompositeReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestParallelCompositeReader.cs
@@ -477,7 +477,7 @@ namespace Lucene.Net.Index
ParallelCompositeReader pr = new ParallelCompositeReader(new CompositeReader[] { ir1 });
string s = pr.ToString();
- Assert.IsTrue(s.StartsWith("ParallelCompositeReader(ParallelAtomicReader("), "toString incorrect: " + s);
+ Assert.IsTrue(s.StartsWith("ParallelCompositeReader(ParallelAtomicReader(", StringComparison.Ordinal), "toString incorrect: " + s);
pr.Dispose();
dir1.Dispose();
@@ -492,7 +492,7 @@ namespace Lucene.Net.Index
string s = pr.ToString();
- Assert.IsTrue(s.StartsWith("ParallelCompositeReader(ParallelCompositeReaderAnonymousInnerClassHelper(ParallelAtomicReader("), "toString incorrect: " + s);
+ Assert.IsTrue(s.StartsWith("ParallelCompositeReader(ParallelCompositeReaderAnonymousInnerClassHelper(ParallelAtomicReader(", StringComparison.Ordinal), "toString incorrect: " + s);
pr.Dispose();
dir1.Dispose();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestPayloads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestPayloads.cs b/src/Lucene.Net.Tests/Index/TestPayloads.cs
index 210f5ec..ba5038e 100644
--- a/src/Lucene.Net.Tests/Index/TestPayloads.cs
+++ b/src/Lucene.Net.Tests/Index/TestPayloads.cs
@@ -448,7 +448,7 @@ namespace Lucene.Net.Index
}
// Some values of the same field are to have payloads and others not
- if (Offset + Length <= Data.Length && !TermAttribute.ToString().EndsWith("NO PAYLOAD"))
+ if (Offset + Length <= Data.Length && !TermAttribute.ToString().EndsWith("NO PAYLOAD", StringComparison.Ordinal))
{
BytesRef p = new BytesRef(Data, Offset, Length);
PayloadAtt.Payload = p;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestPersistentSnapshotDeletionPolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestPersistentSnapshotDeletionPolicy.cs b/src/Lucene.Net.Tests/Index/TestPersistentSnapshotDeletionPolicy.cs
index 84c7a59..661605f 100644
--- a/src/Lucene.Net.Tests/Index/TestPersistentSnapshotDeletionPolicy.cs
+++ b/src/Lucene.Net.Tests/Index/TestPersistentSnapshotDeletionPolicy.cs
@@ -64,7 +64,7 @@ namespace Lucene.Net.Index
int count = 0;
foreach (string file in dir.ListAll())
{
- if (file.StartsWith(PersistentSnapshotDeletionPolicy.SNAPSHOTS_PREFIX))
+ if (file.StartsWith(PersistentSnapshotDeletionPolicy.SNAPSHOTS_PREFIX, StringComparison.Ordinal))
{
count++;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestPostingsOffsets.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestPostingsOffsets.cs b/src/Lucene.Net.Tests/Index/TestPostingsOffsets.cs
index 105d939..6eb23dc 100644
--- a/src/Lucene.Net.Tests/Index/TestPostingsOffsets.cs
+++ b/src/Lucene.Net.Tests/Index/TestPostingsOffsets.cs
@@ -187,7 +187,7 @@ namespace Lucene.Net.Index
// check that we have a payload and it starts with "pos"
Assert.IsNotNull(dp.GetPayload());
BytesRef payload = dp.GetPayload();
- Assert.IsTrue(payload.Utf8ToString().StartsWith("pos:"));
+ Assert.IsTrue(payload.Utf8ToString().StartsWith("pos:", StringComparison.Ordinal));
} // note: withPayloads=false doesnt necessarily mean we dont have them from MockAnalyzer!
}
}
@@ -218,7 +218,7 @@ namespace Lucene.Net.Index
// check that we have a payload and it starts with "pos"
Assert.IsNotNull(dp.GetPayload());
BytesRef payload = dp.GetPayload();
- Assert.IsTrue(payload.Utf8ToString().StartsWith("pos:"));
+ Assert.IsTrue(payload.Utf8ToString().StartsWith("pos:", StringComparison.Ordinal));
} // note: withPayloads=false doesnt necessarily mean we dont have them from MockAnalyzer!
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestReaderClosed.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestReaderClosed.cs b/src/Lucene.Net.Tests/Index/TestReaderClosed.cs
index 659cb6b..87e74ca 100644
--- a/src/Lucene.Net.Tests/Index/TestReaderClosed.cs
+++ b/src/Lucene.Net.Tests/Index/TestReaderClosed.cs
@@ -1,6 +1,7 @@
using Lucene.Net.Documents;
using Lucene.Net.Support;
using NUnit.Framework;
+using System;
namespace Lucene.Net.Index
{
@@ -102,7 +103,7 @@ namespace Lucene.Net.Index
//Assert.AreEqual("this IndexReader cannot be used anymore as one of its child readers was closed", ace.Message);
// LUCENENET specific - ObjectDisposedExeption appends the type of object to the end of the message,
// so we need to check the start of the message only.
- assertTrue(ace.Message.StartsWith("this IndexReader cannot be used anymore as one of its child readers was closed"));
+ assertTrue(ace.Message.StartsWith("this IndexReader cannot be used anymore as one of its child readers was closed", StringComparison.Ordinal));
}
finally
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs b/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
index 8989662..724c37c 100644
--- a/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
+++ b/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
@@ -181,7 +181,7 @@ namespace Lucene.Net.Index
long totalBytes2 = 0;
foreach (string fileName in dir.ListAll())
{
- if (!fileName.StartsWith(IndexFileNames.SEGMENTS))
+ if (!fileName.StartsWith(IndexFileNames.SEGMENTS, StringComparison.Ordinal))
{
totalBytes2 += dir.FileLength(fileName);
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Index/TestTransactionRollback.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestTransactionRollback.cs b/src/Lucene.Net.Tests/Index/TestTransactionRollback.cs
index 0ff979a..4f1a673 100644
--- a/src/Lucene.Net.Tests/Index/TestTransactionRollback.cs
+++ b/src/Lucene.Net.Tests/Index/TestTransactionRollback.cs
@@ -58,7 +58,7 @@ namespace Lucene.Net.Index
IDictionary<string, string> ud = commit.UserData;
if (ud.Count > 0)
{
- if (ud["index"].EndsWith(ids))
+ if (ud["index"].EndsWith(ids, StringComparison.Ordinal))
{
last = commit;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs b/src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs
index 0995c13..8012712 100644
--- a/src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs
@@ -83,7 +83,7 @@ namespace Lucene.Net.Search
do
{
string s = te.Term.Utf8ToString();
- if (s.StartsWith(prefix))
+ if (s.StartsWith(prefix, StringComparison.Ordinal))
{
termsWithPrefix.AddLast(new Term("body", s));
}
@@ -112,7 +112,7 @@ namespace Lucene.Net.Search
do
{
- if (te.Term.Utf8ToString().StartsWith(prefix))
+ if (te.Term.Utf8ToString().StartsWith(prefix, StringComparison.Ordinal))
{
termsWithPrefix.AddLast(new Term("body", te.Term.Utf8ToString()));
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Search/TestPhrasePrefixQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestPhrasePrefixQuery.cs b/src/Lucene.Net.Tests/Search/TestPhrasePrefixQuery.cs
index d143f18..a42019d 100644
--- a/src/Lucene.Net.Tests/Search/TestPhrasePrefixQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestPhrasePrefixQuery.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections.Generic;
using System.Linq;
using Lucene.Net.Documents;
@@ -82,7 +83,7 @@ namespace Lucene.Net.Search
do
{
string s = te.Term.Utf8ToString();
- if (s.StartsWith(prefix))
+ if (s.StartsWith(prefix, StringComparison.Ordinal))
{
termsWithPrefix.AddLast(new Term("body", s));
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Search/TestTopFieldCollector.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestTopFieldCollector.cs b/src/Lucene.Net.Tests/Search/TestTopFieldCollector.cs
index 2d1d536..ab2ff21 100644
--- a/src/Lucene.Net.Tests/Search/TestTopFieldCollector.cs
+++ b/src/Lucene.Net.Tests/Search/TestTopFieldCollector.cs
@@ -1,3 +1,5 @@
+using System;
+
namespace Lucene.Net.Search
{
using NUnit.Framework;
@@ -192,7 +194,7 @@ namespace Lucene.Net.Search
{
TopDocsCollector<Entry> tdc = TopFieldCollector.Create(sort[i], 10, tfcOptions[j][0], tfcOptions[j][1], tfcOptions[j][2], false);
- Assert.IsTrue(tdc.GetType().Name.EndsWith(actualTFCClasses[j]));
+ Assert.IsTrue(tdc.GetType().Name.EndsWith(actualTFCClasses[j], StringComparison.Ordinal));
@is.Search(bq, tdc);
@@ -225,7 +227,7 @@ namespace Lucene.Net.Search
{
TopDocsCollector<Entry> tdc = TopFieldCollector.Create(sort[i], 10, tfcOptions[j][0], tfcOptions[j][1], tfcOptions[j][2], false);
- Assert.IsTrue(tdc.GetType().Name.EndsWith(actualTFCClasses[j]));
+ Assert.IsTrue(tdc.GetType().Name.EndsWith(actualTFCClasses[j], StringComparison.Ordinal));
@is.Search(bq, tdc);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Support/TestByteBuffer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Support/TestByteBuffer.cs b/src/Lucene.Net.Tests/Support/TestByteBuffer.cs
index 0412025..f03598b 100644
--- a/src/Lucene.Net.Tests/Support/TestByteBuffer.cs
+++ b/src/Lucene.Net.Tests/Support/TestByteBuffer.cs
@@ -619,7 +619,7 @@ namespace Lucene.Net.Support
});
- if (rb.GetType().Name.StartsWith("java.nio.Heap"))
+ if (rb.GetType().Name.StartsWith("java.nio.Heap", StringComparison.Ordinal))
{
tryCatch(b, typeof(ReadOnlyBufferException), () =>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Support/TestLongBuffer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Support/TestLongBuffer.cs b/src/Lucene.Net.Tests/Support/TestLongBuffer.cs
index f83ffcc..13bc37a 100644
--- a/src/Lucene.Net.Tests/Support/TestLongBuffer.cs
+++ b/src/Lucene.Net.Tests/Support/TestLongBuffer.cs
@@ -428,7 +428,7 @@ namespace Lucene.Net.Support
//});
- //if (rb.GetType().Name.StartsWith("Heap"))
+ //if (rb.GetType().Name.StartsWith("Heap", StringComparison.Ordinal))
//{
// tryCatch(b, typeof(ReadOnlyBufferException), () =>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
index 76fedad..94f8afd 100644
--- a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
+++ b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
@@ -762,7 +762,7 @@ namespace Lucene.Net.Util.Fst
{
doPack = true;
}
- else if (args[idx].StartsWith("-"))
+ else if (args[idx].StartsWith("-", StringComparison.Ordinal))
{
Console.Error.WriteLine("Unrecognized option: " + args[idx]);
Environment.Exit(-1);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Util/TestConstants.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Util/TestConstants.cs b/src/Lucene.Net.Tests/Util/TestConstants.cs
index c56bf69..9091cb2 100644
--- a/src/Lucene.Net.Tests/Util/TestConstants.cs
+++ b/src/Lucene.Net.Tests/Util/TestConstants.cs
@@ -37,7 +37,7 @@ namespace Lucene.Net.Util
public virtual void TestLuceneMainVersionConstant()
{
Assert.IsTrue(Regex.IsMatch(Constants.LUCENE_MAIN_VERSION, "\\d+\\.\\d+(|\\.0\\.\\d+)", RegexOptions.IgnoreCase), "LUCENE_MAIN_VERSION does not follow pattern: 'x.y' (stable release) or 'x.y.0.z' (alpha/beta version)" + VersionDetails);
- Assert.IsTrue(Constants.LUCENE_VERSION.StartsWith(Constants.MainVersionWithoutAlphaBeta()), "LUCENE_VERSION does not start with LUCENE_MAIN_VERSION (without alpha/beta marker)" + VersionDetails);
+ Assert.IsTrue(Constants.LUCENE_VERSION.StartsWith(Constants.MainVersionWithoutAlphaBeta(), StringComparison.Ordinal), "LUCENE_VERSION does not start with LUCENE_MAIN_VERSION (without alpha/beta marker)" + VersionDetails);
}
[Test]
@@ -54,7 +54,7 @@ namespace Lucene.Net.Util
// remove anything after a "-" from the version string:
version = Regex.Replace(version, "-.*$", "");
string versionConstant = Regex.Replace(Constants.LUCENE_VERSION, "-.*$", "");
- Assert.IsTrue(versionConstant.StartsWith(version) || version.StartsWith(versionConstant), "LUCENE_VERSION should share the same prefix with lucene.version test property ('" + version + "')." + VersionDetails);
+ Assert.IsTrue(versionConstant.StartsWith(version, StringComparison.Ordinal) || version.StartsWith(versionConstant, StringComparison.Ordinal), "LUCENE_VERSION should share the same prefix with lucene.version test property ('" + version + "')." + VersionDetails);
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e61076ab/src/Lucene.Net.Tests/Util/TestWeakIdentityMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Util/TestWeakIdentityMap.cs b/src/Lucene.Net.Tests/Util/TestWeakIdentityMap.cs
index 38da482..ac8cd70 100644
--- a/src/Lucene.Net.Tests/Util/TestWeakIdentityMap.cs
+++ b/src/Lucene.Net.Tests/Util/TestWeakIdentityMap.cs
@@ -121,7 +121,7 @@ namespace Lucene.Net.Util
for (IEnumerator<string> iter = map.Values.GetEnumerator(); iter.MoveNext();)
{
string v = iter.Current;
- Assert.IsTrue(v.StartsWith("bar"));
+ Assert.IsTrue(v.StartsWith("bar", StringComparison.Ordinal));
c++;
}
Assert.AreEqual(3, c);