Changing the AssetBase constructors to avoid initializing assets with an unknown asset type, and log an error if it ever does happen

This commit is contained in:
John Hurliman
2009-11-05 13:10:58 -08:00
parent e6d7303b29
commit afef1ac191
31 changed files with 105 additions and 122 deletions

View File

@@ -1562,11 +1562,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
assets = doc.GetElementsByTagName("RequiredAsset");
foreach (XmlNode asset in assets)
{
AssetBase rass = new AssetBase();
rass.FullID = UUID.Random();
rass.Name = GetStringAttribute(asset,"name","");
AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset,"name",""), SByte.Parse(GetStringAttribute(asset,"type","")));
rass.Description = GetStringAttribute(asset,"desc","");
rass.Type = SByte.Parse(GetStringAttribute(asset,"type",""));
rass.Local = Boolean.Parse(GetStringAttribute(asset,"local",""));
rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary",""));
rass.Data = Convert.FromBase64String(asset.InnerText);

View File

@@ -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", ""));

View File

@@ -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;