diff options
author | John Hurliman | 2009-11-05 13:10:58 -0800 |
---|---|---|
committer | John Hurliman | 2009-11-05 13:10:58 -0800 |
commit | afef1ac191d32e9c1514c294b17e404b1d4ae217 (patch) | |
tree | c390ef81c9c30922c2e95e32844832919884fd9c /OpenSim/ApplicationPlugins | |
parent | Applying #4332, optional packet statistics logging (diff) | |
download | opensim-SC_OLD-afef1ac191d32e9c1514c294b17e404b1d4ae217.zip opensim-SC_OLD-afef1ac191d32e9c1514c294b17e404b1d4ae217.tar.gz opensim-SC_OLD-afef1ac191d32e9c1514c294b17e404b1d4ae217.tar.bz2 opensim-SC_OLD-afef1ac191d32e9c1514c294b17e404b1d4ae217.tar.xz |
Changing the AssetBase constructors to avoid initializing assets with an unknown asset type, and log an error if it ever does happen
Diffstat (limited to 'OpenSim/ApplicationPlugins')
3 files changed, 4 insertions, 14 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 3c7727f..3149eaa 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -1562,11 +1562,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1562 | assets = doc.GetElementsByTagName("RequiredAsset"); | 1562 | assets = doc.GetElementsByTagName("RequiredAsset"); |
1563 | foreach (XmlNode asset in assets) | 1563 | foreach (XmlNode asset in assets) |
1564 | { | 1564 | { |
1565 | AssetBase rass = new AssetBase(); | 1565 | AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset,"name",""), SByte.Parse(GetStringAttribute(asset,"type",""))); |
1566 | rass.FullID = UUID.Random(); | ||
1567 | rass.Name = GetStringAttribute(asset,"name",""); | ||
1568 | rass.Description = GetStringAttribute(asset,"desc",""); | 1566 | rass.Description = GetStringAttribute(asset,"desc",""); |
1569 | rass.Type = SByte.Parse(GetStringAttribute(asset,"type","")); | ||
1570 | rass.Local = Boolean.Parse(GetStringAttribute(asset,"local","")); | 1567 | rass.Local = Boolean.Parse(GetStringAttribute(asset,"local","")); |
1571 | rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary","")); | 1568 | rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary","")); |
1572 | rass.Data = Convert.FromBase64String(asset.InnerText); | 1569 | rass.Data = Convert.FromBase64String(asset.InnerText); |
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 | |||
261 | modified = (asset != null); | 261 | modified = (asset != null); |
262 | created = !modified; | 262 | created = !modified; |
263 | 263 | ||
264 | asset = new AssetBase(); | 264 | asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type"))); |
265 | asset.FullID = uuid; | ||
266 | asset.Name = xml.GetAttribute("name"); | ||
267 | asset.Description = xml.GetAttribute("desc"); | 265 | asset.Description = xml.GetAttribute("desc"); |
268 | asset.Type = SByte.Parse(xml.GetAttribute("type")); | ||
269 | asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; | 266 | asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; |
270 | asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; | 267 | asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; |
271 | asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); | 268 | asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); |
@@ -341,11 +338,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
341 | modified = (asset != null); | 338 | modified = (asset != null); |
342 | created = !modified; | 339 | created = !modified; |
343 | 340 | ||
344 | asset = new AssetBase(); | 341 | asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type"))); |
345 | asset.FullID = uuid; | ||
346 | asset.Name = xml.GetAttribute("name"); | ||
347 | asset.Description = xml.GetAttribute("desc"); | 342 | asset.Description = xml.GetAttribute("desc"); |
348 | asset.Type = SByte.Parse(xml.GetAttribute("type")); | ||
349 | asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; | 343 | asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; |
350 | asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; | 344 | asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; |
351 | asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); | 345 | 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 | |||
1869 | 1869 | ||
1870 | // Create AssetBase entity to hold the inlined asset | 1870 | // Create AssetBase entity to hold the inlined asset |
1871 | 1871 | ||
1872 | asset = new AssetBase(uuid, name); | 1872 | asset = new AssetBase(uuid, name, type); |
1873 | 1873 | ||
1874 | asset.Description = desc; | 1874 | asset.Description = desc; |
1875 | asset.Type = type; // type == 0 == texture | ||
1876 | asset.Local = local; | 1875 | asset.Local = local; |
1877 | asset.Temporary = temp; | 1876 | asset.Temporary = temp; |
1878 | 1877 | ||