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/ConfigurationMember.cs | |
parent | fixed svn:ignore on POSPlugin (diff) | |
download | opensim-SC-946db5461c8262d3b957e42ed7a90feb447c618b.zip opensim-SC-946db5461c8262d3b957e42ed7a90feb447c618b.tar.gz opensim-SC-946db5461c8262d3b957e42ed7a90feb447c618b.tar.bz2 opensim-SC-946db5461c8262d3b957e42ed7a90feb447c618b.tar.xz |
catch exceptions when loading malformed xml files
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/ConfigurationMember.cs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/OpenSim/Framework/ConfigurationMember.cs b/OpenSim/Framework/ConfigurationMember.cs index e4cd9d8..8e46a04 100644 --- a/OpenSim/Framework/ConfigurationMember.cs +++ b/OpenSim/Framework/ConfigurationMember.cs | |||
@@ -166,8 +166,16 @@ namespace OpenSim.Framework | |||
166 | if (configurationFilename.Trim() != "") | 166 | if (configurationFilename.Trim() != "") |
167 | { | 167 | { |
168 | configurationPlugin.SetFileName(configurationFilename); | 168 | configurationPlugin.SetFileName(configurationFilename); |
169 | configurationPlugin.LoadData(); | 169 | try |
170 | useFile = true; | 170 | { |
171 | configurationPlugin.LoadData(); | ||
172 | useFile = true; | ||
173 | } | ||
174 | catch (XmlException e) | ||
175 | { | ||
176 | MainLog.Instance.Error("Error loading " + configurationFilename + ": " + e.ToString()); | ||
177 | useFile = false; | ||
178 | } | ||
171 | } | 179 | } |
172 | else | 180 | else |
173 | { | 181 | { |
@@ -189,7 +197,6 @@ namespace OpenSim.Framework | |||
189 | bool ignoreNextFromConfig = false; | 197 | bool ignoreNextFromConfig = false; |
190 | while (convertSuccess == false) | 198 | while (convertSuccess == false) |
191 | { | 199 | { |
192 | |||
193 | string console_result = ""; | 200 | string console_result = ""; |
194 | string attribute = null; | 201 | string attribute = null; |
195 | if (useFile || (!useFile && configurationFromXMLNode != null)) | 202 | if (useFile || (!useFile && configurationFromXMLNode != null)) |
@@ -228,7 +235,6 @@ namespace OpenSim.Framework | |||
228 | //Dont Ask! Just use default | 235 | //Dont Ask! Just use default |
229 | console_result = configOption.configurationDefault; | 236 | console_result = configOption.configurationDefault; |
230 | } | 237 | } |
231 | |||
232 | } | 238 | } |
233 | } | 239 | } |
234 | else | 240 | else |
@@ -292,7 +298,6 @@ namespace OpenSim.Framework | |||
292 | { | 298 | { |
293 | convertSuccess = true; | 299 | convertSuccess = true; |
294 | return_result = intResult; | 300 | return_result = intResult; |
295 | |||
296 | } | 301 | } |
297 | errorMessage = "a signed 32 bit integer (int)"; | 302 | errorMessage = "a signed 32 bit integer (int)"; |
298 | break; | 303 | break; |
@@ -347,7 +352,6 @@ namespace OpenSim.Framework | |||
347 | { | 352 | { |
348 | convertSuccess = true; | 353 | convertSuccess = true; |
349 | return_result = uintResult; | 354 | return_result = uintResult; |
350 | |||
351 | } | 355 | } |
352 | errorMessage = "an unsigned 32 bit integer (uint)"; | 356 | errorMessage = "an unsigned 32 bit integer (uint)"; |
353 | break; | 357 | break; |
@@ -387,7 +391,6 @@ namespace OpenSim.Framework | |||
387 | configurationPlugin.SetAttribute(configOption.configurationKey, console_result); | 391 | configurationPlugin.SetAttribute(configOption.configurationKey, console_result); |
388 | } | 392 | } |
389 | 393 | ||
390 | |||
391 | if (!this.resultFunction(configOption.configurationKey, return_result)) | 394 | if (!this.resultFunction(configOption.configurationKey, return_result)) |
392 | { | 395 | { |
393 | Console.MainLog.Instance.Notice("The handler for the last configuration option denied that input, please try again."); | 396 | Console.MainLog.Instance.Notice("The handler for the last configuration option denied that input, please try again."); |