From e28738c13b4eb3e1a3a2fc6e8edbc2584e50c0fb Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 17 Feb 2009 18:19:24 +0000 Subject: * Assign incoming items with a random UUID so that archives can be loaded more than once * Also remove a duplicate write archive call in the unit test which might be causing test failures for people using mono 2.2 (though not 1.9.1, it would seem) --- .../Inventory/Archiver/InventoryArchiveReadRequest.cs | 15 ++++----------- .../Inventory/Archiver/InventoryArchiveWriteRequest.cs | 2 ++ .../Inventory/Archiver/Tests/InventoryArchiverTests.cs | 2 -- 3 files changed, 6 insertions(+), 13 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 6b57ac5..dfa4100 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -104,17 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver reader.ReadStartElement("Owner"); item.Owner = UUID.Parse(reader.ReadString()); reader.ReadEndElement(); - //No description would kill it - if (reader.IsEmptyElement) - { - reader.ReadStartElement("Description"); - } - else - { - reader.ReadStartElement("Description"); - item.Description = reader.ReadString(); - reader.ReadEndElement(); - } + reader.ReadElementString("Description"); reader.ReadStartElement("AssetType"); item.AssetType = Convert.ToInt32(reader.ReadString()); reader.ReadEndElement(); @@ -225,6 +215,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (item != null) { + // Don't use the item ID that's in the file + item.ID = UUID.Random(); + item.Creator = m_userInfo.UserProfile.ID; item.Owner = m_userInfo.UserProfile.ID; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 456831d..be700e9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -109,6 +109,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver path, inventoryItem.Name, inventoryItem.ID); StringWriter sw = new StringWriter(); XmlTextWriter writer = new XmlTextWriter(sw); + writer.Formatting = Formatting.Indented; + writer.WriteStartElement("InventoryObject"); writer.WriteStartElement("Name"); writer.WriteString(inventoryItem.Name); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index c43f543..dafce81 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -113,8 +113,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests MemoryStream archiveWriteStream = new MemoryStream(); archiverModule.OnInventoryArchiveSaved += SaveCompleted; - - archiverModule.ArchiveInventory(userFirstName, userLastName, "Objects", archiveWriteStream); lock (this) { -- cgit v1.1