From 3984a7fda1c37d5aaec7f6c7d12ce2804a0c750e Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 30 Apr 2008 19:55:45 +0000 Subject: * Resolve mantis 1068, 1095 * The resolution takes the form of not crashing the session if the folder the user is attempting to add already exists (e.g. there is one already with the same UUID). * Printing out warnings instead --- .../Communications/Cache/InventoryFolderImpl.cs | 7 ++++ .../Cache/UserProfileCacheService.cs | 41 ++++++++++++++++------ 2 files changed, 38 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs index 5f532e0..f55f323 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs @@ -62,6 +62,13 @@ namespace OpenSim.Framework.Communications.Cache { } + /// + /// Create a new subfolder. This exists only in the cache. + /// + /// + /// + /// + /// The newly created subfolder. Returns null if the folder already exists public InventoryFolderImpl CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) { lock (SubFolders) diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index ec06a23..4627f75 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -184,6 +184,12 @@ namespace OpenSim.Framework.Communications.Cache createdBaseFolder.Version = createdFolder.Version; m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder); } + else + { + m_log.WarnFormat( + "[INVENTORY CACHE]: Tried to create folder {0} {1} for user {2} {3} but the folder already exists", + folderName, folderID, remoteClient.Name, remoteClient.AgentId); + } } else { @@ -191,16 +197,31 @@ namespace OpenSim.Framework.Communications.Cache if (folder != null) { InventoryFolderImpl createdFolder = folder.CreateNewSubFolder(folderID, folderName, folderType); - - InventoryFolderBase createdBaseFolder = new InventoryFolderBase(); - createdBaseFolder.Owner = createdFolder.Owner; - createdBaseFolder.ID = createdFolder.ID; - createdBaseFolder.Name = createdFolder.Name; - createdBaseFolder.ParentID = createdFolder.ParentID; - createdBaseFolder.Type = createdFolder.Type; - createdBaseFolder.Version = createdFolder.Version; - - m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder); + + if (createdFolder != null) + { + InventoryFolderBase createdBaseFolder = new InventoryFolderBase(); + createdBaseFolder.Owner = createdFolder.Owner; + createdBaseFolder.ID = createdFolder.ID; + createdBaseFolder.Name = createdFolder.Name; + createdBaseFolder.ParentID = createdFolder.ParentID; + createdBaseFolder.Type = createdFolder.Type; + createdBaseFolder.Version = createdFolder.Version; + + m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder); + } + else + { + m_log.WarnFormat( + "[INVENTORY CACHE]: Tried to create folder {0} {1} for user {2} {3} but the folder already exists", + folderName, folderID, remoteClient.Name, remoteClient.AgentId); + } + } + else + { + m_log.WarnFormat( + "[INVENTORY CACHE]: Could not find parent folder with id {0} in order to create folder {1} {2} for user {3} {4}", + parentID, folderName, folderID, remoteClient.Name, remoteClient.AgentId); } } } -- cgit v1.1