lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [14/50] [abbrv] lucenenet git commit: SWEEP: Lucene.Net.Core + Lucene.Net.TestFramework: Changed all string CompareTo() to CompareToOrdinal() and all string Equals() to specify StringComparison.Ordinal
Date Wed, 15 Mar 2017 23:49:56 GMT
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b86fc3ba/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs b/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
index c694a0a..03504c2 100644
--- a/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
+++ b/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
@@ -477,7 +477,7 @@ namespace Lucene.Net.Index
             // If we are writing with PreFlexRW, force a full
             // IndexReader.open so terms are sorted in codepoint
             // order during searching:
-            if (!applyDeletions || !Codec.Name.Equals("Lucene3x") && r.NextBoolean())
+            if (!applyDeletions || !Codec.Name.Equals("Lucene3x", StringComparison.Ordinal)
&& r.NextBoolean())
             {
                 if (LuceneTestCase.VERBOSE)
                 {
@@ -550,7 +550,7 @@ namespace Lucene.Net.Index
 
             public override void Message(string component, string message)
             {
-                if ("TP".Equals(component))
+                if ("TP".Equals(component, StringComparison.Ordinal))
                 {
                     TestPoint.Apply(message);
                 }
@@ -562,7 +562,7 @@ namespace Lucene.Net.Index
 
             public override bool IsEnabled(string component)
             {
-                return "TP".Equals(component) || @delegate.IsEnabled(component);
+                return "TP".Equals(component, StringComparison.Ordinal) || @delegate.IsEnabled(component);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b86fc3ba/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs b/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
index 3e99bcb..2de1ee4 100644
--- a/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
@@ -459,7 +459,7 @@ namespace Lucene.Net.Index
                                 Assert.IsNotNull(diagnostics);
                                 string source = diagnostics["source"];
                                 Assert.IsNotNull(source);
-                                if (source.Equals("merge"))
+                                if (source.Equals("merge", StringComparison.Ordinal))
                                 {
                                     Assert.IsTrue(!OuterInstance.AssertMergedSegmentsWarmed
|| OuterInstance.Warmed.ContainsKey((SegmentCoreReaders)segReader.CoreCacheKey), "sub reader
" + sub + " wasn't warmed: warmed=" + OuterInstance.Warmed + " diagnostics=" + diagnostics
+ " si=" + segReader.SegmentInfo);
                                 }
@@ -824,7 +824,7 @@ namespace Lucene.Net.Index
 
             public override void Message(string component, string message)
             {
-                if ("TP".Equals(component))
+                if ("TP".Equals(component, StringComparison.Ordinal))
                 {
                     return; // ignore test points!
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b86fc3ba/src/Lucene.Net.TestFramework/Search/CheckHits.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Search/CheckHits.cs b/src/Lucene.Net.TestFramework/Search/CheckHits.cs
index 9f12fb4..ac9dbec 100644
--- a/src/Lucene.Net.TestFramework/Search/CheckHits.cs
+++ b/src/Lucene.Net.TestFramework/Search/CheckHits.cs
@@ -394,7 +394,7 @@ namespace Lucene.Net.Search
                             try
                             {
                                 x = Convert.ToSingle(descr.Substring(k1, k2 - k1).Trim());
-                                if (descr.Substring(k2).Trim().Equals("times others of:"))
+                                if (descr.Substring(k2).Trim().Equals("times others of:",
StringComparison.Ordinal))
                                 {
                                     maxTimesOthers = true;
                                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b86fc3ba/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs b/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs
index 12dc165..723d379 100644
--- a/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs
+++ b/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs
@@ -85,7 +85,7 @@ namespace Lucene.Net.Search
 
                 FieldAndShardVersion other = (FieldAndShardVersion)_other;
 
-                return Field.Equals(other.Field) && Version == other.Version &&
NodeID == other.NodeID;
+                return Field.Equals(other.Field, StringComparison.Ordinal) && Version
== other.Version && NodeID == other.NodeID;
             }
 
             public override string ToString()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b86fc3ba/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
index 685f095..b744b50 100644
--- a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
@@ -553,12 +553,12 @@ namespace Lucene.Net.Store
             {
                 foreach (var ent in OpenFileHandles)
                 {
-                    if (input && ent.Key is MockIndexInputWrapper && ((MockIndexInputWrapper)ent.Key).Name.Equals(name))
+                    if (input && ent.Key is MockIndexInputWrapper && ((MockIndexInputWrapper)ent.Key).Name.Equals(name,
StringComparison.Ordinal))
                     {
                         t = CreateException(t, ent.Value);
                         break;
                     }
-                    else if (!input && ent.Key is MockIndexOutputWrapper &&
((MockIndexOutputWrapper)ent.Key).Name.Equals(name))
+                    else if (!input && ent.Key is MockIndexOutputWrapper &&
((MockIndexOutputWrapper)ent.Key).Name.Equals(name, StringComparison.Ordinal))
                     {
                         t = CreateException(t, ent.Value);
                         break;
@@ -661,7 +661,7 @@ namespace Lucene.Net.Store
                 Init();
                 lock (this)
                 {
-                    if (PreventDoubleWrite_Renamed && CreatedFiles.Contains(name)
&& !name.Equals("segments.gen"))
+                    if (PreventDoubleWrite_Renamed && CreatedFiles.Contains(name)
&& !name.Equals("segments.gen", StringComparison.Ordinal))
                     {
                         throw new System.IO.IOException("file \"" + name + "\" was already
written to");
                     }
@@ -692,7 +692,7 @@ namespace Lucene.Net.Store
                     RAMFile existing = ramdir.m_fileMap.ContainsKey(name) ? ramdir.m_fileMap[name]
: null;
 
                     // Enforce write once:
-                    if (existing != null && !name.Equals("segments.gen") &&
PreventDoubleWrite_Renamed)
+                    if (existing != null && !name.Equals("segments.gen", StringComparison.Ordinal)
&& PreventDoubleWrite_Renamed)
                     {
                         throw new System.IO.IOException("file " + name + " already exists");
                     }
@@ -985,7 +985,7 @@ namespace Lucene.Net.Store
                             // an issue (IFD would nuke this stuff eventually), but we pass
NoDeletionPolicy...
                             foreach (string file in pendingDeletions)
                             {
-                                if (file.StartsWith("segments") && !file.Equals("segments.gen")
&& endSet.Contains(file))
+                                if (file.StartsWith("segments", StringComparison.Ordinal)
&& !file.Equals("segments.gen", StringComparison.Ordinal) && endSet.Contains(file))
                                 {
                                     startSet.Add(file);
                                     if (LuceneTestCase.VERBOSE)
@@ -1032,7 +1032,7 @@ namespace Lucene.Net.Store
                             startFiles = startSet.ToArray(/*new string[0]*/);
                             endFiles = endSet.ToArray(/*new string[0]*/);
 
-                            if (!Arrays.Equals(startFiles, endFiles))
+                            if (!Arrays.Equals(startFiles, endFiles)) // LUCENENET TODO:
Possible equals ordinal issue
                             {
                                 IList<string> removed = new List<string>();
                                 foreach (string fileName in startFiles)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b86fc3ba/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 2d8f163..beadd74 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -539,7 +539,7 @@ namespace Lucene.Net.Util
               protected bool verify(Method key)
               {
                   string name = key.Name;
-                  return !(name.Equals("SetUp") || name.Equals("TearDown"));
+                  return !(name.Equals("SetUp", StringComparison.Ordinal) || name.Equals("TearDown",
StringComparison.Ordinal));
               }})
               .around(new SystemPropertiesInvariantRule(IGNORED_INVARIANT_PROPERTIES))
               .around(ClassNameRule = new TestRuleStoreClassName())
@@ -1260,7 +1260,7 @@ namespace Lucene.Net.Util
         private static BaseDirectoryWrapper NewFSDirectory(DirectoryInfo d, LockFactory lf,
bool bare)
         {
             string fsdirClass = TEST_DIRECTORY;
-            if (fsdirClass.Equals("random"))
+            if (fsdirClass.Equals("random", StringComparison.Ordinal))
             {
                 fsdirClass = RandomInts.RandomFrom(Random(), FS_DIRECTORIES);
             }
@@ -1492,7 +1492,7 @@ namespace Lucene.Net.Util
 
         public static bool DefaultCodecSupportsDocValues()
         {
-            return !Codec.Default.Name.Equals("Lucene3x");
+            return !Codec.Default.Name.Equals("Lucene3x", StringComparison.Ordinal);
         }
 
         private static Directory NewFSDirectoryImpl(Type clazz, DirectoryInfo file)
@@ -1502,7 +1502,7 @@ namespace Lucene.Net.Util
 
         private static Directory NewDirectoryImpl(Random random, string clazzName)
         {
-            if (clazzName.Equals("random"))
+            if (clazzName.Equals("random", StringComparison.Ordinal))
             {
                 if (Rarely(random))
                 {
@@ -1823,7 +1823,11 @@ namespace Lucene.Net.Util
         public static bool DefaultCodecSupportsMissingDocValues()
         {
             string name = Codec.Default.Name;
-            if (name.Equals("Lucene3x") || name.Equals("Lucene40") || name.Equals("Appending")
|| name.Equals("Lucene41") || name.Equals("Lucene42"))
+            if (name.Equals("Lucene3x", StringComparison.Ordinal) 
+                || name.Equals("Lucene40", StringComparison.Ordinal) 
+                || name.Equals("Appending", StringComparison.Ordinal) 
+                || name.Equals("Lucene41", StringComparison.Ordinal) 
+                || name.Equals("Lucene42", StringComparison.Ordinal))
             {
                 return false;
             }
@@ -1839,7 +1843,9 @@ namespace Lucene.Net.Util
                 return false;
             }
             string name = Codec.Default.Name;
-            if (name.Equals("Lucene40") || name.Equals("Lucene41") || name.Equals("Appending"))
+            if (name.Equals("Lucene40", StringComparison.Ordinal) 
+                || name.Equals("Lucene41", StringComparison.Ordinal) 
+                || name.Equals("Appending", StringComparison.Ordinal))
             {
                 return false;
             }
@@ -1857,7 +1863,10 @@ namespace Lucene.Net.Util
                 return false;
             }
             string name = Codec.Default.Name;
-            if (name.Equals("Appending") || name.Equals("Lucene40") || name.Equals("Lucene41")
|| name.Equals("Lucene42"))
+            if (name.Equals("Appending", StringComparison.Ordinal) 
+                || name.Equals("Lucene40", StringComparison.Ordinal) 
+                || name.Equals("Lucene41", StringComparison.Ordinal) 
+                || name.Equals("Lucene42", StringComparison.Ordinal))
             {
                 return false;
             }
@@ -1869,7 +1878,12 @@ namespace Lucene.Net.Util
         public static bool DefaultCodecSupportsFieldUpdates()
         {
             string name = Codec.Default.Name;
-            if (name.Equals("Lucene3x") || name.Equals("Appending") || name.Equals("Lucene40")
|| name.Equals("Lucene41") || name.Equals("Lucene42") || name.Equals("Lucene45"))
+            if (name.Equals("Lucene3x", StringComparison.Ordinal) 
+                || name.Equals("Appending", StringComparison.Ordinal) 
+                || name.Equals("Lucene40", StringComparison.Ordinal) 
+                || name.Equals("Lucene41", StringComparison.Ordinal) 
+                || name.Equals("Lucene42", StringComparison.Ordinal) 
+                || name.Equals("Lucene45", StringComparison.Ordinal))
             {
                 return false;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b86fc3ba/src/Lucene.Net.TestFramework/Util/StackTraceHelper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/StackTraceHelper.cs b/src/Lucene.Net.TestFramework/Util/StackTraceHelper.cs
index 1dff47c..c913b41 100644
--- a/src/Lucene.Net.TestFramework/Util/StackTraceHelper.cs
+++ b/src/Lucene.Net.TestFramework/Util/StackTraceHelper.cs
@@ -25,7 +25,7 @@ namespace Lucene.Net.Util
             StackTrace trace = new StackTrace();
             foreach (var frame in trace.GetFrames())
             {
-                if (frame.GetMethod().Name.equals(methodName))
+                if (frame.GetMethod().Name.Equals(methodName, StringComparison.Ordinal))
                 {
                     return true;
                 }
@@ -48,7 +48,7 @@ namespace Lucene.Net.Util
             foreach (var frame in trace.GetFrames())
             {
                 var method = frame.GetMethod();
-                if (method.DeclaringType.Name.equals(className) && method.Name.equals(methodName))
+                if (method.DeclaringType.Name.Equals(className, StringComparison.Ordinal)
&& method.Name.Equals(methodName, StringComparison.Ordinal))
                 {
                     return true;
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b86fc3ba/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
index abcae63..2c392ec 100644
--- a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
@@ -129,9 +129,9 @@ namespace Lucene.Net.Util
 
             savedCodec = Codec.Default;
             int randomVal = random.Next(10);
-            if ("Lucene3x".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC)
&&
-                                                                "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT)
&&
-                                                                "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT)
&&
+            if ("Lucene3x".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal) ||
("random".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal) &&
+                                                                "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT,
StringComparison.Ordinal) &&
+                                                                "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT,
StringComparison.Ordinal) &&
                                                                 randomVal == 3 &&
                                                                 !ShouldAvoidCodec("Lucene3x")))
// preflex-only setup
             {
@@ -139,8 +139,8 @@ namespace Lucene.Net.Util
                 Debug.Assert((codec is PreFlexRWCodec), "fix your ICodecFactory to scan Lucene.Net.Tests
before Lucene.Net.TestFramework");
                 LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
             }
-            else if ("Lucene40".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC)
&&
-                                                                    "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT)
&&
+            else if ("Lucene40".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal)
|| ("random".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT,
StringComparison.Ordinal) &&
                                                                     randomVal == 0 &&
                                                                     !ShouldAvoidCodec("Lucene40")))
// 4.0 setup
             {
@@ -149,9 +149,9 @@ namespace Lucene.Net.Util
                 Debug.Assert((codec is Lucene40RWCodec), "fix your ICodecFactory to scan
Lucene.Net.Tests before Lucene.Net.TestFramework");
                 Debug.Assert((PostingsFormat.ForName("Lucene40") is Lucene40RWPostingsFormat),
"fix your IPostingsFormatFactory to scan Lucene.Net.Tests before Lucene.Net.TestFramework");
             }
-            else if ("Lucene41".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC)
&&
-                                                                    "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT)
&&
-                                                                    "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT)
&&
+            else if ("Lucene41".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal)
|| ("random".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT,
StringComparison.Ordinal) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT,
StringComparison.Ordinal) &&
                                                                     randomVal == 1 &&
                                                                     !ShouldAvoidCodec("Lucene41")))
             {
@@ -159,9 +159,9 @@ namespace Lucene.Net.Util
                 LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
                 Debug.Assert((codec is Lucene41RWCodec), "fix your ICodecFactory to scan
Lucene.Net.Tests before Lucene.Net.TestFramework");
             }
-            else if ("Lucene42".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC)
&&
-                                                                    "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT)
&&
-                                                                    "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT)
&&
+            else if ("Lucene42".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal)
|| ("random".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT,
StringComparison.Ordinal) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT,
StringComparison.Ordinal) &&
                                                                     randomVal == 2 &&
                                                                     !ShouldAvoidCodec("Lucene42")))
             {
@@ -169,9 +169,9 @@ namespace Lucene.Net.Util
                 LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
                 Debug.Assert((codec is Lucene42RWCodec), "fix your ICodecFactory to scan
Lucene.Net.Tests before Lucene.Net.TestFramework");
             }
-            else if ("Lucene45".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC)
&&
-                                                                    "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT)
&&
-                                                                    "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT)
&&
+            else if ("Lucene45".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal)
|| ("random".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT,
StringComparison.Ordinal) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT,
StringComparison.Ordinal) &&
                                                                     randomVal == 5 &&
                                                                     !ShouldAvoidCodec("Lucene45")))
             {
@@ -179,17 +179,18 @@ namespace Lucene.Net.Util
                 LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
                 Debug.Assert((codec is Lucene45RWCodec), "fix your ICodecFactory to scan
Lucene.Net.Tests before Lucene.Net.TestFramework");
             }
-            else if (("random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) == false) || ("random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT)
== false))
+            else if (("random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT, StringComparison.Ordinal)
== false) 
+                || ("random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT, StringComparison.Ordinal)
== false))
             {
                 // the user wired postings or DV: this is messy
                 // refactor into RandomCodec....
 
                 PostingsFormat format;
-                if ("random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT))
+                if ("random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT, StringComparison.Ordinal))
                 {
                     format = PostingsFormat.ForName("Lucene41");
                 }
-                else if ("MockRandom".Equals(LuceneTestCase.TEST_POSTINGSFORMAT))
+                else if ("MockRandom".Equals(LuceneTestCase.TEST_POSTINGSFORMAT, StringComparison.Ordinal))
                 {
                     format = new MockRandomPostingsFormat(new Random(random.Next()));
                 }
@@ -199,7 +200,7 @@ namespace Lucene.Net.Util
                 }
 
                 DocValuesFormat dvFormat;
-                if ("random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT))
+                if ("random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT, StringComparison.Ordinal))
                 {
                     dvFormat = DocValuesFormat.ForName("Lucene45");
                 }
@@ -210,28 +211,32 @@ namespace Lucene.Net.Util
 
                 codec = new Lucene46CodecAnonymousInnerClassHelper(this, format, dvFormat);
             }
-            else if ("SimpleText".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC)
&& randomVal == 9 && LuceneTestCase.Rarely(random) && !ShouldAvoidCodec("SimpleText")))
+            else if ("SimpleText".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal)

+                || ("random".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal)
&& randomVal == 9 && LuceneTestCase.Rarely(random) && !ShouldAvoidCodec("SimpleText")))
             {
                 codec = new SimpleTextCodec();
             }
-            else if ("CheapBastard".equals(LuceneTestCase.TEST_CODEC) || ("random".equals(LuceneTestCase.TEST_CODEC)
&& randomVal == 8 && !ShouldAvoidCodec("CheapBastard") && !ShouldAvoidCodec("Lucene41")))
+            else if ("CheapBastard".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal)

+                || ("random".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal)
&& randomVal == 8 && !ShouldAvoidCodec("CheapBastard") && !ShouldAvoidCodec("Lucene41")))
             {
                 // we also avoid this codec if Lucene41 is avoided, since thats the postings
format it uses.
                 codec = new CheapBastardCodec();
             }
-            else if ("Asserting".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC)
&& randomVal == 6 && !ShouldAvoidCodec("Asserting")))
+            else if ("Asserting".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal)

+                || ("random".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal)
&& randomVal == 6 && !ShouldAvoidCodec("Asserting")))
             {
                 codec = new AssertingCodec();
             }
-            else if ("Compressing".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC)
&& randomVal == 5 && !ShouldAvoidCodec("Compressing")))
+            else if ("Compressing".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal)

+                || ("random".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal)
&& randomVal == 5 && !ShouldAvoidCodec("Compressing")))
             {
                 codec = CompressingCodec.RandomInstance(random);
             }
-            else if (!"random".Equals(LuceneTestCase.TEST_CODEC))
+            else if (!"random".Equals(LuceneTestCase.TEST_CODEC, StringComparison.Ordinal))
             {
                 codec = Codec.ForName(LuceneTestCase.TEST_CODEC);
             }
-            else if ("random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT))
+            else if ("random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT, StringComparison.Ordinal))
             {
                 codec = new RandomCodec(random, avoidCodecs);
             }
@@ -248,7 +253,7 @@ namespace Lucene.Net.Util
             // Always pick a random one for consistency (whether tests.locale was specified
or not).
             savedLocale = CultureInfo.CurrentCulture;
             CultureInfo randomLocale = LuceneTestCase.RandomLocale(random);
-            locale = testLocale.Equals("random") ? randomLocale : LuceneTestCase.LocaleForName(testLocale);
+            locale = testLocale.Equals("random", StringComparison.Ordinal) ? randomLocale
: LuceneTestCase.LocaleForName(testLocale);
 #if NETSTANDARD
             CultureInfo.CurrentCulture = locale;
 #else
@@ -260,7 +265,7 @@ namespace Lucene.Net.Util
             restoreProperties["user.timezone"] = SystemProperties.GetProperty("user.timezone");
             savedTimeZone = testInstance.TimeZone;
             TimeZoneInfo randomTimeZone = LuceneTestCase.RandomTimeZone(random);
-            timeZone = testTimeZone.Equals("random") ? randomTimeZone : TimeZoneInfo.FindSystemTimeZoneById(testTimeZone);
+            timeZone = testTimeZone.Equals("random", StringComparison.Ordinal) ? randomTimeZone
: TimeZoneInfo.FindSystemTimeZoneById(testTimeZone);
             //TimeZone.Default = TimeZone; // LUCENENET NOTE: There doesn't seem to be an
equivalent to this, but I don't think we need it.
 
             //TimeZoneInfo.ConvertTime() // LUCENENET TODO: Everywhere TimeZoneInfo is supposed
to be used, use this method to convert a dateTime object to the time zone
@@ -288,12 +293,12 @@ namespace Lucene.Net.Util
 
             public override void Message(string component, string message)
             {
-                if ("TP".Equals(component))
+                if ("TP".Equals(component, StringComparison.Ordinal))
                 {
                     return; // ignore test points!
                 }
                 string name;
-                if (Thread.CurrentThread.Name != null && Thread.CurrentThread.Name.StartsWith("TEST-"))
+                if (Thread.CurrentThread.Name != null && Thread.CurrentThread.Name.StartsWith("TEST-",
StringComparison.Ordinal))
                 {
                     // The name of the main thread is way too
                     // long when looking at IW verbose output...

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b86fc3ba/src/Lucene.Net.TestFramework/Util/TestUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestUtil.cs b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
index 0867b64..baa1186 100644
--- a/src/Lucene.Net.TestFramework/Util/TestUtil.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
@@ -915,7 +915,9 @@ namespace Lucene.Net.Util
         public static bool FieldSupportsHugeBinaryDocValues(string field)
         {
             string dvFormat = GetDocValuesFormat(field);
-            if (dvFormat.Equals("Lucene40") || dvFormat.Equals("Lucene42") || dvFormat.Equals("Memory"))
+            if (dvFormat.Equals("Lucene40", StringComparison.Ordinal) 
+                || dvFormat.Equals("Lucene42", StringComparison.Ordinal) 
+                || dvFormat.Equals("Memory", StringComparison.Ordinal))
             {
                 return false;
             }
@@ -925,7 +927,7 @@ namespace Lucene.Net.Util
         public static bool AnyFilesExceptWriteLock(Directory dir)
         {
             string[] files = dir.ListAll();
-            if (files.Length > 1 || (files.Length == 1 && !files[0].Equals("write.lock")))
+            if (files.Length > 1 || (files.Length == 1 && !files[0].Equals("write.lock",
StringComparison.Ordinal)))
             {
                 return true;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b86fc3ba/src/Lucene.Net.TestFramework/Util/VirtualMethod.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/VirtualMethod.cs b/src/Lucene.Net.TestFramework/Util/VirtualMethod.cs
index f9341c6..3cd0c04 100644
--- a/src/Lucene.Net.TestFramework/Util/VirtualMethod.cs
+++ b/src/Lucene.Net.TestFramework/Util/VirtualMethod.cs
@@ -168,7 +168,7 @@ namespace Lucene.Net.Util
         {
 #if NETSTANDARD
             var methods = clazz.GetTypeInfo().GetMethods(bindingFlags).Where(x => {
-                return x.Name.Equals(methodName)
+                return x.Name.Equals(methodName, StringComparison.Ordinal)
                     && x.GetParameters().Select(y => y.ParameterType).SequenceEqual(methodParameters);
                 }).ToArray();
 


Mime
View raw message