aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJohn Hurliman2009-11-05 13:10:58 -0800
committerJohn Hurliman2009-11-05 13:10:58 -0800
commitafef1ac191d32e9c1514c294b17e404b1d4ae217 (patch)
treec390ef81c9c30922c2e95e32844832919884fd9c /OpenSim/Region
parentApplying #4332, optional packet statistics logging (diff)
downloadopensim-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/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs5
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs5
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs3
-rw-r--r--OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs7
15 files changed, 27 insertions, 56 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs
index 697bbe6..adf171e 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs
@@ -197,11 +197,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
197 197
198 private void Initialise(UUID fileID, string fileName) 198 private void Initialise(UUID fileID, string fileName)
199 { 199 {
200 m_asset = new AssetBase(); 200 m_asset = new AssetBase(fileID, fileName, type);
201 m_asset.FullID = fileID;
202 m_asset.Type = type;
203 m_asset.Data = new byte[0]; 201 m_asset.Data = new byte[0];
204 m_asset.Name = fileName;
205 m_asset.Description = "empty"; 202 m_asset.Description = "empty";
206 m_asset.Local = true; 203 m_asset.Local = true;
207 m_asset.Temporary = true; 204 m_asset.Temporary = true;
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index e192b81..f698ea1 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -112,11 +112,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
112 bool storeLocal, bool tempFile) 112 bool storeLocal, bool tempFile)
113 { 113 {
114 ourClient = remoteClient; 114 ourClient = remoteClient;
115 m_asset = new AssetBase(); 115 m_asset = new AssetBase(assetID, "blank", type);
116 m_asset.FullID = assetID;
117 m_asset.Type = type;
118 m_asset.Data = data; 116 m_asset.Data = data;
119 m_asset.Name = "blank";
120 m_asset.Description = "empty"; 117 m_asset.Description = "empty";
121 m_asset.Local = storeLocal; 118 m_asset.Local = storeLocal;
122 m_asset.Temporary = tempFile; 119 m_asset.Temporary = tempFile;
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 7456e8c..5fde35f 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -238,12 +238,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
238 238
239 if (m_cache != null) 239 if (m_cache != null)
240 { 240 {
241 AssetBase layerDecodeAsset = new AssetBase(); 241 string assetID = "j2kCache_" + AssetId.ToString();
242 layerDecodeAsset.ID = "j2kCache_" + AssetId.ToString(); 242
243 AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard);
243 layerDecodeAsset.Local = true; 244 layerDecodeAsset.Local = true;
244 layerDecodeAsset.Name = layerDecodeAsset.ID;
245 layerDecodeAsset.Temporary = true; 245 layerDecodeAsset.Temporary = true;
246 layerDecodeAsset.Type = (sbyte)AssetType.Notecard;
247 246
248 #region Serialize Layer Data 247 #region Serialize Layer Data
249 248
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
389 { 389 {
390 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; 390 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
391 391
392 //m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); 392 if (assetType == (sbyte)AssetType.Unknown)
393 m_log.WarnFormat("[INVENTORY ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid);
393 394
394 AssetBase asset = new AssetBase(new UUID(uuid), "RandomName"); 395 //m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
395 396
396 asset.Type = assetType; 397 AssetBase asset = new AssetBase(new UUID(uuid), "RandomName", assetType);
397 asset.Data = data; 398 asset.Data = data;
398 399
399 m_scene.AssetService.Store(asset); 400 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
122 } 122 }
123 123
124 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); 124 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
125 AssetBase asset1 = new AssetBase(); 125 AssetBase asset1 = new AssetBase(asset1Id, asset1Id.ToString(), (sbyte)AssetType.Object);
126 asset1.FullID = asset1Id;
127 asset1.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(object1)); 126 asset1.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(object1));
128 scene.AssetService.Store(asset1); 127 scene.AssetService.Store(asset1);
129 128
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
index 9a6c49a..43761fc 100644
--- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -311,11 +311,8 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
311 } 311 }
312 312
313 // Create a new asset for user 313 // Create a new asset for user
314 AssetBase asset = new AssetBase(); 314 AssetBase asset = new AssetBase(UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture);
315 asset.FullID = UUID.Random();
316 asset.Data = assetData; 315 asset.Data = assetData;
317 asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
318 asset.Type = 0;
319 asset.Description = String.Format("URL image : {0}", Url); 316 asset.Description = String.Format("URL image : {0}", Url);
320 asset.Local = false; 317 asset.Local = false;
321 asset.Temporary = ((Disp & DISP_TEMP) != 0); 318 asset.Temporary = ((Disp & DISP_TEMP) != 0);
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index c261943..70a225e 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -332,10 +332,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
332 { 332 {
333 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; 333 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
334 334
335 if (assetType == (sbyte)AssetType.Unknown)
336 m_log.WarnFormat("[ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid);
337
335 //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); 338 //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
336 339
337 AssetBase asset = new AssetBase(new UUID(uuid), String.Empty); 340 AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType);
338 asset.Type = assetType;
339 asset.Data = data; 341 asset.Data = data;
340 342
341 // We're relying on the asset service to do the sensible thing and not store the asset if it already 343 // We're relying on the asset service to do the sensible thing and not store the asset if it already
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs
index 5208e7a..2d2c570 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs
@@ -158,9 +158,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
158 158
159 m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); 159 m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename);
160 160
161 AssetBase asset = new AssetBase(new UUID(filename), metadata.Name); 161 AssetBase asset = new AssetBase(new UUID(filename), metadata.Name, metadata.AssetType);
162 asset.Description = metadata.Description; 162 asset.Description = metadata.Description;
163 asset.Type = metadata.AssetType;
164 asset.Data = data; 163 asset.Data = data;
165 164
166 m_cache.Store(asset); 165 m_cache.Store(asset);
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs b/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs
index ddac515..2ff635b 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs
@@ -52,16 +52,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
52 52
53 public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename) 53 public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename)
54 { 54 {
55 55 m_asset = new AssetBase(UUID.Zero, pClientFilename, type);
56 m_asset = new AssetBase();
57 m_asset.FullID = UUID.Zero;
58 m_asset.Type = type;
59 m_asset.Data = new byte[0]; 56 m_asset.Data = new byte[0];
60 m_asset.Name = pClientFilename;
61 m_asset.Description = "empty"; 57 m_asset.Description = "empty";
62 m_asset.Local = true; 58 m_asset.Local = true;
63 m_asset.Temporary = true; 59 m_asset.Temporary = true;
64
65 } 60 }
66 61
67 public ulong XferID 62 public ulong XferID
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index f4b54aa..44a651f 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -1077,14 +1077,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1077 1077
1078 m_scene.RegionInfo.RegionSettings.TerrainImageID = TerrainImageUUID; 1078 m_scene.RegionInfo.RegionSettings.TerrainImageID = TerrainImageUUID;
1079 1079
1080 AssetBase asset = new AssetBase(); 1080 AssetBase asset = new AssetBase(
1081 asset.FullID = m_scene.RegionInfo.RegionSettings.TerrainImageID; 1081 m_scene.RegionInfo.RegionSettings.TerrainImageID,
1082 "terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(),
1083 (sbyte)AssetType.Texture);
1082 asset.Data = data; 1084 asset.Data = data;
1083 asset.Name
1084 = "terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString();
1085 asset.Description = m_scene.RegionInfo.RegionName; 1085 asset.Description = m_scene.RegionInfo.RegionName;
1086
1087 asset.Type = 0;
1088 asset.Temporary = temporary; 1086 asset.Temporary = temporary;
1089 m_scene.AssetService.Store(asset); 1087 m_scene.AssetService.Store(asset);
1090 } 1088 }
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
index 7a66d23..ec50598 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
118 // HGAssetService dispatches it to the remote grid. 118 // HGAssetService dispatches it to the remote grid.
119 // It's not pretty, but the best that can be done while 119 // It's not pretty, but the best that can be done while
120 // not having a global naming infrastructure 120 // not having a global naming infrastructure
121 AssetBase asset1 = new AssetBase(); 121 AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type);
122 Copy(asset, asset1); 122 Copy(asset, asset1);
123 try 123 try
124 { 124 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 00743fc..6b2c7d3 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -627,11 +627,8 @@ namespace OpenSim.Region.Framework.Scenes
627 /// <returns></returns> 627 /// <returns></returns>
628 private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) 628 private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data)
629 { 629 {
630 AssetBase asset = new AssetBase(); 630 AssetBase asset = new AssetBase(UUID.Random(), name, assetType);
631 asset.Name = name;
632 asset.Description = description; 631 asset.Description = description;
633 asset.Type = assetType;
634 asset.FullID = UUID.Random();
635 asset.Data = (data == null) ? new byte[1] : data; 632 asset.Data = (data == null) ? new byte[1] : data;
636 633
637 return asset; 634 return asset;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1e9201e..17026e5 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1918,14 +1918,10 @@ namespace OpenSim.Region.Framework.Scenes
1918 } 1918 }
1919 1919
1920 1920
1921 AssetBase Animasset = new AssetBase(); 1921 AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation);
1922 Animasset.Data = anim.ToBytes(); 1922 Animasset.Data = anim.ToBytes();
1923 Animasset.Temporary = true; 1923 Animasset.Temporary = true;
1924 Animasset.Local = true; 1924 Animasset.Local = true;
1925 Animasset.FullID = UUID.Random();
1926 Animasset.ID = Animasset.FullID.ToString();
1927 Animasset.Name = "Random Animation";
1928 Animasset.Type = (sbyte)AssetType.Animation;
1929 Animasset.Description = "dance"; 1925 Animasset.Description = "dance";
1930 //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data); 1926 //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data);
1931 1927
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs
index 963cab5..8ea7ad3 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs
@@ -49,11 +49,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
49 49
50 public UUID SaveBitmap(Bitmap data, bool lossless, bool temporary) 50 public UUID SaveBitmap(Bitmap data, bool lossless, bool temporary)
51 { 51 {
52 AssetBase asset = new AssetBase(); 52 AssetBase asset = new AssetBase(UUID.Random(), "MRMDynamicImage", (sbyte)AssetType.Texture);
53 asset.FullID = UUID.Random();
54 asset.Data = OpenJPEG.EncodeFromImage(data, lossless); 53 asset.Data = OpenJPEG.EncodeFromImage(data, lossless);
55 asset.Name = "MRMDynamicImage";
56 asset.Type = 0;
57 asset.Description = "MRM Image"; 54 asset.Description = "MRM Image";
58 asset.Local = false; 55 asset.Local = false;
59 asset.Temporary = temporary; 56 asset.Temporary = temporary;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index f1ceb80..f7ee3d9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1483,12 +1483,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1483 m_host.AddScriptLPS(1); 1483 m_host.AddScriptLPS(1);
1484 1484
1485 // Create new asset 1485 // Create new asset
1486 AssetBase asset = new AssetBase(); 1486 AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard);
1487 asset.Name = notecardName;
1488 asset.Description = "Script Generated Notecard"; 1487 asset.Description = "Script Generated Notecard";
1489 asset.Type = 7; 1488 string notecardData = String.Empty;
1490 asset.FullID = UUID.Random();
1491 string notecardData = "";
1492 1489
1493 for (int i = 0; i < contents.Length; i++) { 1490 for (int i = 0; i < contents.Length; i++) {
1494 notecardData += contents.GetLSLStringItem(i) + "\n"; 1491 notecardData += contents.GetLSLStringItem(i) + "\n";