aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
authorJeff Ames2007-11-17 05:53:12 +0000
committerJeff Ames2007-11-17 05:53:12 +0000
commit946db5461c8262d3b957e42ed7a90feb447c618b (patch)
tree7ba5a76429f19881d684a9c317210f39e4cc70b1 /OpenSim/Framework/Communications
parentfixed svn:ignore on POSPlugin (diff)
downloadopensim-SC_OLD-946db5461c8262d3b957e42ed7a90feb447c618b.zip
opensim-SC_OLD-946db5461c8262d3b957e42ed7a90feb447c618b.tar.gz
opensim-SC_OLD-946db5461c8262d3b957e42ed7a90feb447c618b.tar.bz2
opensim-SC_OLD-946db5461c8262d3b957e42ed7a90feb447c618b.tar.xz
catch exceptions when loading malformed xml files
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServerBase.cs38
-rw-r--r--OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs13
2 files changed, 34 insertions, 17 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
index 7692057..1a20cee 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
@@ -2,6 +2,7 @@ using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.IO; 3using System.IO;
4using System.Threading; 4using System.Threading;
5using System.Xml;
5using libsecondlife; 6using libsecondlife;
6using Nini.Config; 7using Nini.Config;
7using OpenSim.Framework.Console; 8using OpenSim.Framework.Console;
@@ -148,22 +149,29 @@ namespace OpenSim.Framework.Communications.Cache
148 string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); 149 string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml");
149 if (File.Exists(filePath)) 150 if (File.Exists(filePath))
150 { 151 {
151 XmlConfigSource source = new XmlConfigSource(filePath); 152 try
152 153 {
153 for (int i = 0; i < source.Configs.Count; i++) 154 XmlConfigSource source = new XmlConfigSource(filePath);
155
156 for (int i = 0; i < source.Configs.Count; i++)
157 {
158 // System.Console.WriteLine("loading asset into database");
159 string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated());
160 string name = source.Configs[i].GetString("name", "");
161 sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0);
162 sbyte invType = (sbyte) source.Configs[i].GetInt("inventoryType", 0);
163 string fileName = source.Configs[i].GetString("fileName", "");
164
165 AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false);
166
167 newAsset.Type = type;
168 newAsset.InvType = invType;
169 assets.Add(newAsset);
170 }
171 }
172 catch (XmlException e)
154 { 173 {
155 // System.Console.WriteLine("loading asset into database"); 174 MainLog.Instance.Error("ASSETS", "Error loading " + filePath + ": " + e.ToString());
156 string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated());
157 string name = source.Configs[i].GetString("name", "");
158 sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0);
159 sbyte invType = (sbyte) source.Configs[i].GetInt("inventoryType", 0);
160 string fileName = source.Configs[i].GetString("fileName", "");
161
162 AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false);
163
164 newAsset.Type = type;
165 newAsset.InvType = invType;
166 assets.Add(newAsset);
167 } 175 }
168 } 176 }
169 assets.ForEach(action); 177 assets.ForEach(action);
diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
index 765c42e..05caa84 100644
--- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
@@ -27,8 +27,10 @@
27*/ 27*/
28 28
29using System.IO; 29using System.IO;
30using System.Xml;
30using libsecondlife; 31using libsecondlife;
31using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework.Console;
32 34
33namespace OpenSim.Framework.Communications.Cache 35namespace OpenSim.Framework.Communications.Cache
34{ 36{
@@ -65,8 +67,15 @@ namespace OpenSim.Framework.Communications.Cache
65 string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml"); 67 string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml");
66 if (File.Exists(filePath)) 68 if (File.Exists(filePath))
67 { 69 {
68 XmlConfigSource source = new XmlConfigSource(filePath); 70 try
69 ReadItemsFromFile(source); 71 {
72 XmlConfigSource source = new XmlConfigSource(filePath);
73 ReadItemsFromFile(source);
74 }
75 catch (XmlException e)
76 {
77 MainLog.Instance.Error("INVENTORY", "Error loading " + filePath + ": " + e.ToString());
78 }
70 } 79 }
71 } 80 }
72 81