diff --git a/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs index 411ee3161c..65e95751b2 100644 --- a/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs @@ -97,34 +97,30 @@ namespace OpenSim.Framework.Servers.HttpServer return false; } - if (!response.ContainsKey("_Result")) + OSD osdtmp; + if (!response.TryGetValue("_Result", out osdtmp) || !(osdtmp is OSDMap)) { m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an invalid response: {2}", method, uri, OSDParser.SerializeJsonString(response)); return false; } - response = (OSDMap)response["_Result"]; - OSD data; - - if (response.ContainsKey("error")) + response = osdtmp as OSDMap; + if (response.TryGetValue("error", out osdtmp)) { - data = response["error"]; m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an error: {2}", - method, uri, OSDParser.SerializeJsonString(data)); + method, uri, OSDParser.SerializeJsonString(osdtmp)); return false; } - if (!response.ContainsKey("result")) + if (!response.TryGetValue("result", out osdtmp) || !(osdtmp is OSDMap)) { m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an invalid response: {2}", method, uri, OSDParser.SerializeJsonString(response)); return false; } - data = response["result"]; - OSD.DeserializeMembers(ref parameters, (OSDMap)data); - + OSD.DeserializeMembers(ref parameters, (OSDMap)osdtmp); return true; } @@ -168,19 +164,20 @@ namespace OpenSim.Framework.Servers.HttpServer return false; } - if (!response.ContainsKey("_Result")) + OSD osdtmp; + if (!response.TryGetValue("_Result", out osdtmp) || !(osdtmp is OSDMap)) { m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an invalid response: {2}", method, uri, OSDParser.SerializeJsonString(response)); return false; } - response = (OSDMap)response["_Result"]; + response = osdtmp as OSDMap; - if (response.ContainsKey("error")) + if (response.TryGetValue("error", out osdtmp)) { - data = response["error"]; + data = osdtmp; m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an error: {2}", - method, uri, OSDParser.SerializeJsonString(data)); + method, uri, OSDParser.SerializeJsonString(osdtmp)); return false; } diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/ContextTimeoutManager.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/ContextTimeoutManager.cs index d3f89508ad..6aa6d5b5a5 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/ContextTimeoutManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/ContextTimeoutManager.cs @@ -31,7 +31,6 @@ using System.Diagnostics; using System.Globalization; using System.Net.Sockets; using System.Threading; -using System.Threading.Tasks; namespace OSHttpServer { diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/IHttpClientContext.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/IHttpClientContext.cs index 38725e505c..aa5b8af851 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/IHttpClientContext.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/IHttpClientContext.cs @@ -1,7 +1,6 @@ using System; using System.Net; using System.Net.Sockets; -using System.Threading.Tasks; namespace OSHttpServer { diff --git a/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs b/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs index cbf8c5f460..994b44e7c2 100644 --- a/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs @@ -25,9 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Threading.Tasks; -using Nini.Config; using OpenSim.Framework; using OpenMetaverse;