From afef1ac191d32e9c1514c294b17e404b1d4ae217 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 5 Nov 2009 13:10:58 -0800 Subject: Changing the AssetBase constructors to avoid initializing assets with an unknown asset type, and log an error if it ever does happen --- .../Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 7 ++++--- .../Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index f761bf0..a4445eb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -389,11 +389,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; - //m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); + if (assetType == (sbyte)AssetType.Unknown) + m_log.WarnFormat("[INVENTORY ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid); - AssetBase asset = new AssetBase(new UUID(uuid), "RandomName"); + //m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); - asset.Type = assetType; + AssetBase asset = new AssetBase(new UUID(uuid), "RandomName", assetType); asset.Data = data; m_scene.AssetService.Store(asset); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index b0fdcd6..8ee9194 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -122,8 +122,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests } UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); - AssetBase asset1 = new AssetBase(); - asset1.FullID = asset1Id; + AssetBase asset1 = new AssetBase(asset1Id, asset1Id.ToString(), (sbyte)AssetType.Object); asset1.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(object1)); scene.AssetService.Store(asset1); -- cgit v1.1 From 1cddc850783c4dcf49ca3cd845fdc811ffb20dea Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 6 Nov 2009 00:06:49 -0800 Subject: Fixing the build break --- .../Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 41bb9dc..e300eb1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -337,8 +337,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests } UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); - AssetBase asset1 = new AssetBase(); - asset1.FullID = asset1Id; + AssetBase asset1 = new AssetBase(asset1Id, String.Empty, (sbyte)AssetType.Object); asset1.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(object1)); scene.AssetService.Store(asset1); -- cgit v1.1