diff options
author | Sean Dague | 2009-03-06 19:25:33 +0000 |
---|---|---|
committer | Sean Dague | 2009-03-06 19:25:33 +0000 |
commit | 08509d5cf281004dca6ec42cd1d76a7896b0e73a (patch) | |
tree | 53630a26483aad15eb4d97c87e7a7ebae362a9ee /OpenSim | |
parent | Added a output message to CreateCommsManagerPlugin for when a user tries to r... (diff) | |
download | opensim-SC_OLD-08509d5cf281004dca6ec42cd1d76a7896b0e73a.zip opensim-SC_OLD-08509d5cf281004dca6ec42cd1d76a7896b0e73a.tar.gz opensim-SC_OLD-08509d5cf281004dca6ec42cd1d76a7896b0e73a.tar.bz2 opensim-SC_OLD-08509d5cf281004dca6ec42cd1d76a7896b0e73a.tar.xz |
* Protects RestClient from crashing with dictionary exception, which leads to the client thread crashing if uncaught.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Communications/RestClient.cs | 26 |
1 files changed, 24 insertions, 2 deletions
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 | |||
165 | /// <param name="value">Value of the parameter, e.g. 42</param> | 165 | /// <param name="value">Value of the parameter, e.g. 42</param> |
166 | public void AddQueryParameter(string name, string value) | 166 | public void AddQueryParameter(string name, string value) |
167 | { | 167 | { |
168 | _parameterElements.Add(HttpUtility.UrlEncode(name), HttpUtility.UrlEncode(value)); | 168 | try |
169 | { | ||
170 | _parameterElements.Add(HttpUtility.UrlEncode(name), HttpUtility.UrlEncode(value)); | ||
171 | } | ||
172 | catch (ArgumentException) | ||
173 | { | ||
174 | m_log.Error("[REST]: Query parameter " + name + " is already added."); | ||
175 | } | ||
176 | catch (Exception e) | ||
177 | { | ||
178 | m_log.Error("[REST]: An exception was raised adding query parameter to dictionary. Exception: {0}",e); | ||
179 | } | ||
169 | } | 180 | } |
170 | 181 | ||
171 | /// <summary> | 182 | /// <summary> |
@@ -174,7 +185,18 @@ namespace OpenSim.Framework.Communications | |||
174 | /// <param name="name">Name of the parameter, e.g. min</param> | 185 | /// <param name="name">Name of the parameter, e.g. min</param> |
175 | public void AddQueryParameter(string name) | 186 | public void AddQueryParameter(string name) |
176 | { | 187 | { |
177 | _parameterElements.Add(HttpUtility.UrlEncode(name), null); | 188 | try |
189 | { | ||
190 | _parameterElements.Add(HttpUtility.UrlEncode(name), null); | ||
191 | } | ||
192 | catch (ArgumentException) | ||
193 | { | ||
194 | m_log.Error("[REST]: Query parameter " + name + " is already added."); | ||
195 | } | ||
196 | catch (Exception e) | ||
197 | { | ||
198 | m_log.Error("[REST]: An exception was raised adding query parameter to dictionary. Exception: {0}",e); | ||
199 | } | ||
178 | } | 200 | } |
179 | 201 | ||
180 | /// <summary> | 202 | /// <summary> |