From 08509d5cf281004dca6ec42cd1d76a7896b0e73a Mon Sep 17 00:00:00 2001
From: Sean Dague
Date: Fri, 6 Mar 2009 19:25:33 +0000
Subject: * Protects RestClient from crashing with dictionary exception, which
leads to the client thread crashing if uncaught.
---
OpenSim/Framework/Communications/RestClient.cs | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs
index 3035da5..db5010b 100644
--- a/OpenSim/Framework/Communications/RestClient.cs
+++ b/OpenSim/Framework/Communications/RestClient.cs
@@ -165,7 +165,18 @@ namespace OpenSim.Framework.Communications
/// Value of the parameter, e.g. 42
public void AddQueryParameter(string name, string value)
{
- _parameterElements.Add(HttpUtility.UrlEncode(name), HttpUtility.UrlEncode(value));
+ try
+ {
+ _parameterElements.Add(HttpUtility.UrlEncode(name), HttpUtility.UrlEncode(value));
+ }
+ catch (ArgumentException)
+ {
+ m_log.Error("[REST]: Query parameter " + name + " is already added.");
+ }
+ catch (Exception e)
+ {
+ m_log.Error("[REST]: An exception was raised adding query parameter to dictionary. Exception: {0}",e);
+ }
}
///
@@ -174,7 +185,18 @@ namespace OpenSim.Framework.Communications
/// Name of the parameter, e.g. min
public void AddQueryParameter(string name)
{
- _parameterElements.Add(HttpUtility.UrlEncode(name), null);
+ try
+ {
+ _parameterElements.Add(HttpUtility.UrlEncode(name), null);
+ }
+ catch (ArgumentException)
+ {
+ m_log.Error("[REST]: Query parameter " + name + " is already added.");
+ }
+ catch (Exception e)
+ {
+ m_log.Error("[REST]: An exception was raised adding query parameter to dictionary. Exception: {0}",e);
+ }
}
///
--
cgit v1.1