* SimianAssetServiceConnector Delete() was expecting the wrong type of response, reporting false errors

* Fixed a typo in a WebUtil error message
0.7-release
John Hurliman 2010-06-24 13:43:38 -07:00
parent 4f59a865af
commit 31b7279095
2 changed files with 23 additions and 8 deletions

View File

@ -114,7 +114,7 @@ namespace OpenSim.Framework
} }
catch (Exception ex) catch (Exception ex)
{ {
m_log.Warn("GET from URL " + url + " failed: " + ex.Message); m_log.Warn(httpVerb + " on URL " + url + " failed: " + ex.Message);
errorMessage = ex.Message; errorMessage = ex.Message;
} }

View File

@ -371,19 +371,34 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns></returns> /// <returns></returns>
public bool Delete(string id) public bool Delete(string id)
{ {
string errorMessage = String.Empty;
string url = m_serverUrl + id;
if (m_cache != null) if (m_cache != null)
m_cache.Expire(id); m_cache.Expire(id);
string url = m_serverUrl + id; try
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "DELETE";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
if (response.StatusCode != HttpStatusCode.NoContent)
{
m_log.Warn("[SIMIAN ASSET CONNECTOR]: Unexpected response when deleting asset " + url + ": " +
response.StatusCode + " (" + response.StatusDescription + ")");
}
}
OSDMap response = WebUtil.ServiceRequest(url, "DELETE");
if (response["Success"].AsBoolean())
return true; return true;
else }
m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to delete asset " + id + " from the asset service"); catch (Exception ex)
{
m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to delete asset " + id + " from the asset service: " + ex.Message);
return false; return false;
} }
}
#endregion IAssetService #endregion IAssetService