Skip to content

Commit

Permalink
Fixing FxCop and StyleCop warnings. No Functional changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimevans committed Feb 20, 2013
1 parent 313e091 commit fac748e
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions dotnet/src/WebDriver/Remote/HttpCommandExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,24 @@ public virtual Response Execute(Command commandToExecute)
return this.CreateResponse(request);
}

private static string GetTextOfWebResponse(HttpWebResponse webResponse)
{
// StreamReader.Close also closes the underlying stream.
Stream responseStream = webResponse.GetResponseStream();
StreamReader responseStreamReader = new StreamReader(responseStream, Encoding.UTF8);
string responseString = responseStreamReader.ReadToEnd();
responseStreamReader.Close();

// The response string from the Java remote server has trailing null
// characters. This is due to the fix for issue 288.
if (responseString.IndexOf('\0') >= 0)
{
responseString = responseString.Substring(0, responseString.IndexOf('\0'));
}

return responseString;
}

private Response CreateResponse(WebRequest request)
{
Response commandResponse = new Response();
Expand All @@ -134,7 +152,7 @@ private Response CreateResponse(WebRequest request)
else if (ex.Response == null)
{
string nullResponseMessage = "A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL {0}. The status of the exception was {1}, and the message was: {2}";
throw new WebDriverException(string.Format(nullResponseMessage, request.RequestUri.AbsoluteUri, ex.Status, ex.Message), ex);
throw new WebDriverException(string.Format(CultureInfo.InvariantCulture, nullResponseMessage, request.RequestUri.AbsoluteUri, ex.Status, ex.Message), ex);
}
}

Expand Down Expand Up @@ -198,23 +216,5 @@ private Response CreateResponse(WebRequest request)
}

#endregion

private static string GetTextOfWebResponse(HttpWebResponse webResponse)
{
// StreamReader.Close also closes the underlying stream.
Stream responseStream = webResponse.GetResponseStream();
StreamReader responseStreamReader = new StreamReader(responseStream, Encoding.UTF8);
string responseString = responseStreamReader.ReadToEnd();
responseStreamReader.Close();

// The response string from the Java remote server has trailing null
// characters. This is due to the fix for issue 288.
if (responseString.IndexOf('\0') >= 0)
{
responseString = responseString.Substring(0, responseString.IndexOf('\0'));
}

return responseString;
}
}
}

0 comments on commit fac748e

Please sign in to comment.