Using String.Equals for string equality comparison
Closes-Bug: 1306227 Change-Id: Ifa40d5330813a9d67de9d65460356a21ed1a17e0
This commit is contained in:
@@ -54,7 +54,7 @@ namespace OpenStack.Identity
|
||||
{
|
||||
//https://someidentityendpoint:35357/v2.0/tokens
|
||||
var endpointSegs = credential.AuthenticationEndpoint.Segments;
|
||||
if (endpointSegs.Count() == 3 && string.Compare(endpointSegs[1].Trim('/'), "v2.0", StringComparison.Ordinal) == 0)
|
||||
if (endpointSegs.Count() == 3 && string.Equals(endpointSegs[1].Trim('/'), "v2.0", StringComparison.Ordinal))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenStack.Identity
|
||||
|
||||
var ret = string.Empty;
|
||||
|
||||
var identService = catalog.FirstOrDefault(s => string.Compare(s.Name, serviceName, StringComparison.OrdinalIgnoreCase) == 0);
|
||||
var identService = catalog.FirstOrDefault(s => string.Equals(s.Name, serviceName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (identService == null)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenStack.Identity
|
||||
/// <inheritdoc/>
|
||||
public bool Exists(string serviceName)
|
||||
{
|
||||
return this.Any(s => string.Compare(s.Name, serviceName, StringComparison.OrdinalIgnoreCase) == 0);
|
||||
return this.Any(s => string.Equals(s.Name, serviceName, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -31,19 +31,19 @@ namespace OpenStack.Identity
|
||||
serviceName.AssertIsNotNullOrEmpty("serviceName", "Cannot resolve the public endpoint of a service with a null or empty service name.");
|
||||
serviceName.AssertIsNotNullOrEmpty("region", "Cannot resolve the public endpoint of a service with a null or empty region.");
|
||||
|
||||
if (catalog.All(s => string.Compare(s.Name, serviceName, StringComparison.OrdinalIgnoreCase) != 0))
|
||||
if (catalog.All(s => !string.Equals(s.Name, serviceName, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
throw new InvalidOperationException(string.Format("Service catalog does not contain an entry for the '{0}' service. The request could not be completed.", serviceName));
|
||||
}
|
||||
|
||||
var service = catalog.First(s => string.Compare(s.Name, serviceName, StringComparison.OrdinalIgnoreCase) == 0);
|
||||
var service = catalog.First(s => string.Equals(s.Name, serviceName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (service.Endpoints.All(e => string.Compare(e.Region, region, StringComparison.OrdinalIgnoreCase) != 0))
|
||||
if (service.Endpoints.All(e => !string.Equals(e.Region, region, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
throw new InvalidOperationException(string.Format("Service catalog does not contain an endpoint for the '{0}' service in the requested region. Region: '{1}'", serviceName, region));
|
||||
}
|
||||
|
||||
var endpoint = service.Endpoints.First(e => string.Compare(e.Region, region, StringComparison.OrdinalIgnoreCase) == 0);
|
||||
var endpoint = service.Endpoints.First(e => string.Equals(e.Region, region, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
return endpoint.PublicUri;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user