diff options
author | Jeff Ames | 2007-11-17 05:53:12 +0000 |
---|---|---|
committer | Jeff Ames | 2007-11-17 05:53:12 +0000 |
commit | 946db5461c8262d3b957e42ed7a90feb447c618b (patch) | |
tree | 7ba5a76429f19881d684a9c317210f39e4cc70b1 /OpenSim/Framework/Communications/Cache/AssetServerBase.cs | |
parent | fixed svn:ignore on POSPlugin (diff) | |
download | opensim-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/Cache/AssetServerBase.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetServerBase.cs | 38 |
1 files changed, 23 insertions, 15 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; | |||
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.IO; | 3 | using System.IO; |
4 | using System.Threading; | 4 | using System.Threading; |
5 | using System.Xml; | ||
5 | using libsecondlife; | 6 | using libsecondlife; |
6 | using Nini.Config; | 7 | using Nini.Config; |
7 | using OpenSim.Framework.Console; | 8 | using 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); |