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 --- OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs | 10 ++-------- .../ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs | 3 +-- 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'OpenSim/ApplicationPlugins/Rest/Inventory') diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs index f862af1..66572d5 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs @@ -261,11 +261,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory modified = (asset != null); created = !modified; - asset = new AssetBase(); - asset.FullID = uuid; - asset.Name = xml.GetAttribute("name"); + asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type"))); asset.Description = xml.GetAttribute("desc"); - asset.Type = SByte.Parse(xml.GetAttribute("type")); asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); @@ -341,11 +338,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory modified = (asset != null); created = !modified; - asset = new AssetBase(); - asset.FullID = uuid; - asset.Name = xml.GetAttribute("name"); + asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type"))); asset.Description = xml.GetAttribute("desc"); - asset.Type = SByte.Parse(xml.GetAttribute("type")); asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index 4e03e67..01bfe00 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs @@ -1869,10 +1869,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // Create AssetBase entity to hold the inlined asset - asset = new AssetBase(uuid, name); + asset = new AssetBase(uuid, name, type); asset.Description = desc; - asset.Type = type; // type == 0 == texture asset.Local = local; asset.Temporary = temp; -- cgit v1.1