Resolve error where an unknown asset type would cause the fetch inventory descendents cap to fail.

Introduced just a few commits ago in 0688861
iar_mods
Justin Clark-Casey (justincc) 2011-11-25 23:43:57 +00:00
parent 676d32974a
commit 5b4fe23f7f
2 changed files with 44 additions and 44 deletions

View File

@ -42,7 +42,6 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Capabilities.Handlers
{
public class WebFetchInvDescHandler
{
private static readonly ILog m_log =
@ -60,7 +59,9 @@ namespace OpenSim.Capabilities.Handlers
public string FetchInventoryDescendentsRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request");
lock (m_fetchLock)
{
// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request {0}", request);
// nasty temporary hack here, the linden client falsely
// identifies the uuid 00000000-0000-0000-0000-000000000000
@ -82,17 +83,16 @@ namespace OpenSim.Capabilities.Handlers
{
hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
}
catch (LLSD.LLSDParseException pe)
catch (LLSD.LLSDParseException e)
{
m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message);
m_log.Error("Request: " + request.ToString());
m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
m_log.Error("Request: " + request);
}
ArrayList foldersrequested = (ArrayList)hash["folders"];
string response = "";
lock (m_fetchLock)
{
for (int i = 0; i < foldersrequested.Count; i++)
{
string inventoryitemstr = "";
@ -106,7 +106,7 @@ namespace OpenSim.Capabilities.Handlers
}
catch (Exception e)
{
m_log.Debug("[CAPS]: caught exception doing OSD deserialize" + e);
m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e);
}
LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest);
@ -130,12 +130,12 @@ namespace OpenSim.Capabilities.Handlers
response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
}
//m_log.DebugFormat("[CAPS]: Replying to CAPS fetch inventory request with following xml");
//m_log.Debug("[CAPS] "+response);
}
// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request");
//m_log.Debug("[WEB FETCH INV DESC HANDLER] "+response);
return response;
}
}
/// <summary>
@ -184,7 +184,8 @@ namespace OpenSim.Capabilities.Handlers
return reply;
}
public InventoryCollection Fetch(UUID agentID, UUID folderID, UUID ownerID,
public InventoryCollection Fetch(
UUID agentID, UUID folderID, UUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder, out int version)
{
m_log.DebugFormat(
@ -194,6 +195,7 @@ namespace OpenSim.Capabilities.Handlers
version = 0;
InventoryFolderImpl fold;
if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner)
{
if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
{
InventoryCollection ret = new InventoryCollection();
@ -202,6 +204,7 @@ namespace OpenSim.Capabilities.Handlers
return ret;
}
}
InventoryCollection contents = new InventoryCollection();
@ -236,7 +239,7 @@ namespace OpenSim.Capabilities.Handlers
llsdFolder.parent_id = invFolder.ParentID;
llsdFolder.name = invFolder.Name;
if (!Enum.IsDefined(typeof(AssetType), invFolder.Type))
if (invFolder.Type == (short)AssetType.Unknown || !Enum.IsDefined(typeof(AssetType), (sbyte)invFolder.Type))
llsdFolder.type = "-1";
else
llsdFolder.type = Utils.AssetTypeToString((AssetType)invFolder.Type);

View File

@ -48,8 +48,7 @@ namespace OpenSim.Region.ClientStack.Linden
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class WebFetchInvDescModule : INonSharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene;
@ -120,8 +119,6 @@ namespace OpenSim.Region.ClientStack.Linden
private void RegisterCaps(UUID agentID, Caps caps)
{
UUID capID = UUID.Random();
if (m_webFetchInventoryDescendentsUrl != "")
RegisterFetchCap(agentID, caps, "WebFetchInventoryDescendents", m_webFetchInventoryDescendentsUrl);
else if (m_fetchInventoryDescendents2Url != "")