* Protects RestClient from crashing with dictionary exception, which leads to the client thread crashing if uncaught.
parent
498dda1901
commit
08509d5cf2
|
@ -164,18 +164,40 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <param name="name">Name of the parameter, e.g. min</param>
|
/// <param name="name">Name of the parameter, e.g. min</param>
|
||||||
/// <param name="value">Value of the parameter, e.g. 42</param>
|
/// <param name="value">Value of the parameter, e.g. 42</param>
|
||||||
public void AddQueryParameter(string name, string value)
|
public void AddQueryParameter(string name, string value)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
_parameterElements.Add(HttpUtility.UrlEncode(name), HttpUtility.UrlEncode(value));
|
_parameterElements.Add(HttpUtility.UrlEncode(name), HttpUtility.UrlEncode(value));
|
||||||
}
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
m_log.Error("[REST]: Query parameter " + name + " is already added.");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error("[REST]: An exception was raised adding query parameter to dictionary. Exception: {0}",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a query parameter to the Url
|
/// Add a query parameter to the Url
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">Name of the parameter, e.g. min</param>
|
/// <param name="name">Name of the parameter, e.g. min</param>
|
||||||
public void AddQueryParameter(string name)
|
public void AddQueryParameter(string name)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
_parameterElements.Add(HttpUtility.UrlEncode(name), null);
|
_parameterElements.Add(HttpUtility.UrlEncode(name), null);
|
||||||
}
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
m_log.Error("[REST]: Query parameter " + name + " is already added.");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error("[REST]: An exception was raised adding query parameter to dictionary. Exception: {0}",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Web-Request method, e.g. GET, PUT, POST, DELETE
|
/// Web-Request method, e.g. GET, PUT, POST, DELETE
|
||||||
|
|
Loading…
Reference in New Issue