From ce8ea55f4e863acad6597f5c199eecaa8726b117 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 17 Sep 2014 17:25:07 +0100 Subject: ... and a few more.. --- .../Avatar/UserProfiles/UserProfileModule.cs | 49 ++++++++++++++-------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index d359ebc..db8405b 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -1239,19 +1239,25 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles return false; } - Stream rstream = webResponse.GetResponseStream(); - OSDMap mret = new OSDMap(); - try - { - mret = (OSDMap)OSDParser.DeserializeJson(rstream); - } - catch (Exception e) + + using (Stream rstream = webResponse.GetResponseStream()) { - m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); - return false; + try + { + mret = (OSDMap)OSDParser.DeserializeJson(rstream); + } + catch (Exception e) + { + m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); + if (webResponse != null) + webResponse.Close(); + return false; + } } + if (webResponse != null) + webResponse.Close(); if (mret.ContainsKey("error")) return false; @@ -1315,19 +1321,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles return false; } - Stream rstream = webResponse.GetResponseStream(); - OSDMap response = new OSDMap(); - try - { - response = (OSDMap)OSDParser.DeserializeJson(rstream); - } - catch (Exception e) + + using (Stream rstream = webResponse.GetResponseStream()) { - m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); - return false; + try + { + response = (OSDMap)OSDParser.DeserializeJson(rstream); + } + catch (Exception e) + { + m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); + if (webResponse != null) + webResponse.Close(); + return false; + } } + if (webResponse != null) + webResponse.Close(); + if(response.ContainsKey("error")) { data = response["error"]; -- cgit v1.1