From 029c9548040e0206640f41151f4a4643540bfeff Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 7 Sep 2010 13:43:36 -0700 Subject: * Added sanity checks to the SimianAssetServiceConnector so it will throw a sensible error message when it is misconfigured instead of a mysterious "Uri is empty" error --- .../SimianGrid/SimianAssetServiceConnector.cs | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 99e6983..caeabb7 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -116,6 +116,12 @@ namespace OpenSim.Services.Connectors.SimianGrid public AssetBase Get(string id) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + // Cache fetch if (m_cache != null) { @@ -142,6 +148,12 @@ namespace OpenSim.Services.Connectors.SimianGrid /// public AssetMetadata GetMetadata(string id) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + AssetMetadata metadata = null; // Cache fetch @@ -213,6 +225,12 @@ namespace OpenSim.Services.Connectors.SimianGrid /// True if the id was parseable, false otherwise public bool Get(string id, Object sender, AssetRetrieved handler) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + // Cache fetch if (m_cache != null) { @@ -243,6 +261,12 @@ namespace OpenSim.Services.Connectors.SimianGrid /// public string Store(AssetBase asset) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + bool storedInCache = false; string errorMessage = null; @@ -375,6 +399,12 @@ namespace OpenSim.Services.Connectors.SimianGrid /// public bool Delete(string id) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + //string errorMessage = String.Empty; string url = m_serverUrl + id; -- cgit v1.1