diff options
author | Oren Hurvitz | 2014-04-18 16:21:59 +0300 |
---|---|---|
committer | Oren Hurvitz | 2014-04-20 06:23:38 +0100 |
commit | 3f76f721372496011efc9328783f9f446b91a92b (patch) | |
tree | f18d8962103e902003a1ce6899b71f652cdad44d /OpenSim/Services/Connectors/Asset | |
parent | Stopped setting the Service URL "GatekeeperURI" on users' accounts. It isn't ... (diff) | |
download | opensim-SC-3f76f721372496011efc9328783f9f446b91a92b.zip opensim-SC-3f76f721372496011efc9328783f9f446b91a92b.tar.gz opensim-SC-3f76f721372496011efc9328783f9f446b91a92b.tar.bz2 opensim-SC-3f76f721372496011efc9328783f9f446b91a92b.tar.xz |
Better error-handling when storing assets: recognize that 'null' is an error value
Diffstat (limited to 'OpenSim/Services/Connectors/Asset')
-rw-r--r-- | OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 32415e9..910c0d7 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -221,7 +221,7 @@ namespace OpenSim.Services.Connectors | |||
221 | AsynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, | 221 | AsynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, |
222 | delegate(AssetBase a) | 222 | delegate(AssetBase a) |
223 | { | 223 | { |
224 | if (m_Cache != null) | 224 | if (a != null && m_Cache != null) |
225 | m_Cache.Cache(a); | 225 | m_Cache.Cache(a); |
226 | 226 | ||
227 | AssetRetrievedEx handlers; | 227 | AssetRetrievedEx handlers; |
@@ -287,7 +287,7 @@ namespace OpenSim.Services.Connectors | |||
287 | 287 | ||
288 | string uri = m_ServerURI + "/assets/"; | 288 | string uri = m_ServerURI + "/assets/"; |
289 | 289 | ||
290 | string newID = string.Empty; | 290 | string newID; |
291 | try | 291 | try |
292 | { | 292 | { |
293 | newID = SynchronousRestObjectRequester. | 293 | newID = SynchronousRestObjectRequester. |
@@ -295,19 +295,18 @@ namespace OpenSim.Services.Connectors | |||
295 | } | 295 | } |
296 | catch (Exception e) | 296 | catch (Exception e) |
297 | { | 297 | { |
298 | m_log.WarnFormat("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1}", asset.ID, e.Message); | 298 | m_log.Warn(string.Format("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1} ", asset.ID, e.Message), e); |
299 | return string.Empty; | ||
299 | } | 300 | } |
300 | 301 | ||
301 | if (newID != String.Empty) | 302 | if (string.IsNullOrEmpty(newID)) |
302 | { | 303 | return string.Empty; |
303 | // Placing this here, so that this work with old asset servers that don't send any reply back | 304 | |
304 | // SynchronousRestObjectRequester returns somethins that is not an empty string | 305 | asset.ID = newID; |
305 | if (newID != null) | 306 | |
306 | asset.ID = newID; | 307 | if (m_Cache != null) |
308 | m_Cache.Cache(asset); | ||
307 | 309 | ||
308 | if (m_Cache != null) | ||
309 | m_Cache.Cache(asset); | ||
310 | } | ||
311 | return newID; | 310 | return newID; |
312 | } | 311 | } |
313 | 312 | ||