Skip to content

Commit c0ae67c

Browse files
committed
fix #634 instances of ToLower that needed to be ToLowerInvariant()
1 parent 2a04493 commit c0ae67c

File tree

20 files changed

+53
-52
lines changed

20 files changed

+53
-52
lines changed

Diff for: src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiQueryParameters.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public string CsharpType(string paramName)
1818
case "list":
1919
return "params string[]";
2020
case "number":
21-
return new [] {"boost", "percen"}.Any(s=>paramName.ToLower().Contains(s))
21+
return new [] {"boost", "percen"}.Any(s=>paramName.ToLowerInvariant().Contains(s))
2222
? "double" : "int";
2323
case "time":
2424
case "duration":

Diff for: src/Connections/Elasticsearch.Net.Connection.HttpClient/ElasticsearchHttpClient.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public ElasticsearchResponse<Stream> DoSyncRequest<T>(string method, Uri uri, by
2525
HttpContent content = null;
2626
if (data != null)
2727
content = new ByteArrayContent(data);
28-
switch (method.ToLower())
28+
switch (method.ToLowerInvariant())
2929
{
3030
case "head":
3131
response = client.SendAsync(new HttpRequestMessage(HttpMethod.Head, uri)).Result;

Diff for: src/Connections/Elasticsearch.Net.Connection.Thrift/Transport/TFramedTransport.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public TFramedTransport(string host, int port, TSocketSettings socketSettings)
4141
if (socketSettings == null)
4242
throw new ArgumentNullException("socketSettings");
4343

44-
if (host.ToLower() == "localhost")
44+
if (host.ToLowerInvariant() == "localhost")
4545
{
4646
host = "127.0.0.1";
4747
}

Diff for: src/Elasticsearch.Net/Connection/HttpConnection.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ protected virtual HttpWebRequest CreateWebRequest(Uri uri, string method, byte[]
182182
//WebRequest won't send Content-Length: 0 for empty bodies
183183
//which goes against RFC's and might break i.e IIS when used as a proxy.
184184
//see: https://github.com/elasticsearch/elasticsearch-net/issues/562
185-
var m = method.ToLower();
185+
var m = method.ToLowerInvariant();
186186
if (m != "head" && m != "get" && (data == null || data.Length == 0))
187187
myReq.ContentLength = 0;
188188

Diff for: src/Nest/DSL/Facets/DateHistogramFacetDescriptor.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ public DateHistogramFacetDescriptor<T> OnField(Expression<Func<T, object>> objec
6666
}
6767
public DateHistogramFacetDescriptor<T> Interval(DateInterval interval)
6868
{
69-
var intervalString = Enum.GetName(typeof(DateInterval), interval).ToLower();
69+
var intervalString = Enum.GetName(typeof(DateInterval), interval).ToLowerInvariant();
7070
this._Interval = intervalString;
7171
return this;
7272
}
7373
public DateHistogramFacetDescriptor<T> Interval(DateInterval interval, DateRounding dateRounding)
7474
{
75-
var intervalString = Enum.GetName(typeof(DateInterval), interval).ToLower();
76-
var roundingString = Enum.GetName(typeof(DateRounding), dateRounding).ToLower();
75+
var intervalString = Enum.GetName(typeof(DateInterval), interval).ToLowerInvariant();
76+
var roundingString = Enum.GetName(typeof(DateRounding), dateRounding).ToLowerInvariant();
7777
this._Interval = intervalString + ":" + roundingString;
7878
return this;
7979
}

Diff for: src/Nest/DSL/Query/MultiMatchQueryDescriptor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public MultiMatchQueryDescriptor<T> TieBreaker(double tieBreaker)
153153

154154
public MultiMatchQueryDescriptor<T> Type(TextQueryType type)
155155
{
156-
this._Type = type.ToString().ToLower();
156+
this._Type = type.ToString().ToLowerInvariant();
157157
return this;
158158
}
159159
}

Diff for: src/Nest/DSL/Suggest/DirectGeneratorDescriptor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public DirectGeneratorDescriptor<T> Size(int size)
6161

6262
public DirectGeneratorDescriptor<T> SuggestMode(SuggestMode mode)
6363
{
64-
this._SuggestMode = Enum.GetName(typeof(SuggestMode), mode).ToLower();
64+
this._SuggestMode = Enum.GetName(typeof(SuggestMode), mode).ToLowerInvariant();
6565
return this;
6666
}
6767

Diff for: src/Nest/DSL/Suggest/TermSuggestDescriptor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public TermSuggestDescriptor<T> ShardSize(int size)
6767

6868
public TermSuggestDescriptor<T> SuggestMode(SuggestMode mode)
6969
{
70-
this._SuggestMode = Enum.GetName(typeof(SuggestMode), mode).ToLower();
70+
this._SuggestMode = Enum.GetName(typeof(SuggestMode), mode).ToLowerInvariant();
7171
return this;
7272
}
7373

Diff for: src/Nest/Domain/Connection/ConnectionSettings.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public ConnectionSettings(IConnectionPool connectionPool, string defaultIndex) :
9090
if (!defaultIndex.IsNullOrEmpty())
9191
this.SetDefaultIndex(defaultIndex);
9292

93-
this._defaultTypeNameInferrer = (t => t.Name.ToLower());
93+
this._defaultTypeNameInferrer = (t => t.Name.ToLowerInvariant());
9494
this._defaultPropertyNameInferrer = (p => p.ToCamelCase());
9595
this._defaultIndices = new FluentDictionary<Type, string>();
9696
this._defaultTypeNames = new FluentDictionary<Type, string>();
@@ -150,7 +150,7 @@ public T SetDefaultIndex(string defaultIndex)
150150
private string LowerCaseAndPluralizeTypeNameInferrer(Type type)
151151
{
152152
type.ThrowIfNull("type");
153-
return Inflector.MakePlural(type.Name).ToLower();
153+
return Inflector.MakePlural(type.Name).ToLowerInvariant();
154154
}
155155

156156
/// <summary>

Diff for: src/Nest/Resolvers/Converters/DynamicMappingOptionConverter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
3636
if (v == null)
3737
return null;
3838

39-
var sv = v.ToString().ToLower();
39+
var sv = v.ToString().ToLowerInvariant();
4040
switch (sv)
4141
{
4242
case "false":

Diff for: src/Nest/Resolvers/Writers/WritePropertiesFromAttributeVisitor.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void VisitBaseAttribute(IElasticPropertyAttribute att) {
3636
{
3737
this._jsonWriter.WritePropertyName("type");
3838
string numericType = Enum.GetName(typeof (NumericType), att.NumericType);
39-
this._jsonWriter.WriteValue(numericType.ToLower());
39+
this._jsonWriter.WriteValue(numericType.ToLowerInvariant());
4040
}
4141
else
4242
{
@@ -129,7 +129,7 @@ public void VisitBaseAttribute(IElasticPropertyAttribute att) {
129129
{
130130
this._jsonWriter.WritePropertyName("type");
131131
string numericType = Enum.GetName(typeof (NumericType), att.NumericType);
132-
this._jsonWriter.WriteValue(numericType.ToLower());
132+
this._jsonWriter.WriteValue(numericType.ToLowerInvariant());
133133
}
134134
else
135135
{

Diff for: src/Profiling/Profiling.Indexing/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private static ConsoleKeyInfo RunIndex(int baseThreadCount, long baseMemorySize)
6363

6464
private static double RunTest<T>(int port, int? messages = null) where T : ITester
6565
{
66-
string type = typeof(T).Name.ToLower();
66+
string type = typeof(T).Name.ToLowerInvariant();
6767
Console.WriteLine("Starting {0} test", type);
6868

6969
// Recreate index up-front, so this process doesn't interfere with perf figures

Diff for: src/Tests/Elasticsearch.Net.Integration.Yaml/cluster.reroute/11_explain.yaml.cs

+6-5
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,20 @@ public class ExplainApiWithEmptyCommandList2Tests : ClusterReroute211ExplainYaml
4040
{
4141
[Test]
4242
public void ExplainApiWithEmptyCommandList2Test()
43-
{
43+
{
4444

4545
//do cluster.reroute
46-
_body = new {
47-
commands= new string[] {}
46+
_body = new
47+
{
48+
commands = new string[] { }
4849
};
49-
this.Do(()=> _client.ClusterReroute(_body, nv=>nv
50+
this.Do(() => _client.ClusterReroute(_body, nv => nv
5051
.AddQueryString("explain", @"true")
5152
.AddQueryString("dry_run", @"true")
5253
));
5354

5455
//match _response.explanations:
55-
this.IsMatch(_response.explanations, new string[] {});
56+
this.IsMatch(_response.explanations, new string[] { });
5657

5758
}
5859
}

Diff for: src/Tests/Nest.Tests.Integration/Core/DeleteTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void GetDocumentById()
3636
var queryResults = this.SearchRaw<ElasticsearchProject>(
3737
@" { ""query"" : {
3838
""fuzzy"" : {
39-
""followers.firstName"" : """ + NestTestData.Data.First().Followers.First().FirstName.ToLower() + @"x""
39+
""followers.firstName"" : """ + NestTestData.Data.First().Followers.First().FirstName.ToLowerInvariant() + @"x""
4040
}
4141
} }"
4242
);

Diff for: src/Tests/Nest.Tests.Integration/Facet/TermFacetResponseTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void SimpleTermFacetWithGlobal()
8484
{
8585
ISearchResponse<ElasticsearchProject> queryResults = this.SearchRaw<ElasticsearchProject>(
8686
@" { ""query"" : {
87-
""term"" : { ""followers.lastName"" : """ + this._LookFor.ToLower() +
87+
""term"" : { ""followers.lastName"" : """ + this._LookFor.ToLowerInvariant() +
8888
@""" }
8989
},
9090
""facets"" : {
@@ -100,7 +100,7 @@ public void SimpleTermFacetWithGlobal()
100100
Assert.IsInstanceOf<TermFacet>(facet);
101101

102102
var tf = (TermFacet) facet;
103-
Assert.IsTrue(tf.Items.Any(f => f.Term == this._LookFor.ToLower()));
103+
Assert.IsTrue(tf.Items.Any(f => f.Term == this._LookFor.ToLowerInvariant()));
104104
}
105105
[Test]
106106
public void TestWithDSL()

Diff for: src/Tests/Nest.Tests.Integration/Indices/IndicesTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void GetIndexSettingsComplex()
111111
Assert.True(r.Settings.Analysis.Analyzers.ContainsKey("swedishlanguage"));
112112
var languageAnalyser = r.Settings.Analysis.Analyzers["swedishlanguage"] as LanguageAnalyzer;
113113
Assert.NotNull(languageAnalyser);
114-
Assert.AreEqual(Language.Swedish.ToString().ToLower(), languageAnalyser.Type);
114+
Assert.AreEqual(Language.Swedish.ToString().ToLowerInvariant(), languageAnalyser.Type);
115115
Assert.NotNull(languageAnalyser.StopWords);
116116
Assert.AreEqual(2, languageAnalyser.StopWords.Count());
117117
Assert.True(languageAnalyser.StopWords.Contains("word1"));

Diff for: src/Tests/Nest.Tests.Integration/Search/CountTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void SimpleQueryCount()
2626
var countResults = this._client.Count<ElasticsearchProject>(c => c
2727
.Query(q => q
2828
.Fuzzy(fq => fq
29-
.Value(this._LookFor.ToLower())
29+
.Value(this._LookFor.ToLowerInvariant())
3030
.OnField(f => f.Followers.First().FirstName)
3131
)
3232
));
@@ -42,7 +42,7 @@ public void SimpleQueryWithIndexAndTypeCount()
4242
.Fuzzy(fq => fq
4343
.PrefixLength(4)
4444
.OnField(f => f.Followers.First().FirstName)
45-
.Value(this._LookFor.ToLower())
45+
.Value(this._LookFor.ToLowerInvariant())
4646
)
4747
));
4848
countResults.Count.Should().BeGreaterThan(0);
@@ -61,7 +61,7 @@ public void SimpleQueryWithIndicesCount()
6161
.Fuzzy(fq => fq
6262
.PrefixLength(4)
6363
.OnField(f => f.Followers.First().FirstName)
64-
.Value(this._LookFor.ToLower())
64+
.Value(this._LookFor.ToLowerInvariant())
6565
)
6666
)
6767
);

Diff for: src/Tests/Nest.Tests.Integration/Search/ExplainTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void ComplexExplain()
3333
""query"" : {
3434
""fuzzy"" : {
3535
""followers.firstName"" : {
36-
""value"" : """ + this._LookFor.ToLower() + @"x"",
36+
""value"" : """ + this._LookFor.ToLowerInvariant() + @"x"",
3737
""boost"" : 1.0,
3838
""min_similarity"" : 0.5,
3939
""prefix_length"" : 0

Diff for: src/Tests/Nest.Tests.Integration/Search/NamedFilter/NamedFilterTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public void SimpleNamedFilter()
1818
.Size(10)
1919
.Fields(p => p.Name)
2020
.Filter(f =>
21-
f.Name("myfilter").Terms(p => p.Name.Suffix("sort"), new[] {_LookFor.ToLower()})
21+
f.Name("myfilter").Terms(p => p.Name.Suffix("sort"), new[] {_LookFor.ToLowerInvariant()})
2222
|| f.Name("myfilter2").Terms(p => p.Name.Suffix("sort"), new[] {"nest"})
2323
)
2424
);

0 commit comments

Comments
 (0)