diff options
author | Justin Clark-Casey (justincc) | 2013-06-12 23:47:47 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-06-12 23:47:47 +0100 |
commit | 824a4b480873721a4a10598299b185b602e1931d (patch) | |
tree | 11b7a20799897f8700daec1c91572167d24d6a36 /OpenSim/Services/HypergridService | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-824a4b480873721a4a10598299b185b602e1931d.zip opensim-SC-824a4b480873721a4a10598299b185b602e1931d.tar.gz opensim-SC-824a4b480873721a4a10598299b185b602e1931d.tar.bz2 opensim-SC-824a4b480873721a4a10598299b185b602e1931d.tar.xz |
After calls to GetSuitcaseXFolder() in HGSuitcaseInventoryService, consistently check for null return and log warning rather than throw exception.
This was being done already in some places.
If an exception is thrown it is now an error rather than debug
Diffstat (limited to 'OpenSim/Services/HypergridService')
-rw-r--r-- | OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index eecf757..410916f 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | |||
@@ -115,6 +115,12 @@ namespace OpenSim.Services.HypergridService | |||
115 | { | 115 | { |
116 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | 116 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); |
117 | 117 | ||
118 | if (suitcase == null) | ||
119 | { | ||
120 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for inventory skeleton", principalID); | ||
121 | return null; | ||
122 | } | ||
123 | |||
118 | List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID); | 124 | List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID); |
119 | if (tree == null || (tree != null && tree.Count == 0)) | 125 | if (tree == null || (tree != null && tree.Count == 0)) |
120 | return null; | 126 | return null; |
@@ -134,6 +140,7 @@ namespace OpenSim.Services.HypergridService | |||
134 | public override InventoryCollection GetUserInventory(UUID userID) | 140 | public override InventoryCollection GetUserInventory(UUID userID) |
135 | { | 141 | { |
136 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Get Suitcase inventory for user {0}", userID); | 142 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Get Suitcase inventory for user {0}", userID); |
143 | |||
137 | InventoryCollection userInventory = new InventoryCollection(); | 144 | InventoryCollection userInventory = new InventoryCollection(); |
138 | userInventory.UserID = userID; | 145 | userInventory.UserID = userID; |
139 | userInventory.Folders = new List<InventoryFolderBase>(); | 146 | userInventory.Folders = new List<InventoryFolderBase>(); |
@@ -141,6 +148,12 @@ namespace OpenSim.Services.HypergridService | |||
141 | 148 | ||
142 | XInventoryFolder suitcase = GetSuitcaseXFolder(userID); | 149 | XInventoryFolder suitcase = GetSuitcaseXFolder(userID); |
143 | 150 | ||
151 | if (suitcase == null) | ||
152 | { | ||
153 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for user inventory", userID); | ||
154 | return null; | ||
155 | } | ||
156 | |||
144 | List<XInventoryFolder> tree = GetFolderTree(userID, suitcase.folderID); | 157 | List<XInventoryFolder> tree = GetFolderTree(userID, suitcase.folderID); |
145 | if (tree == null || (tree != null && tree.Count == 0)) | 158 | if (tree == null || (tree != null && tree.Count == 0)) |
146 | { | 159 | { |
@@ -182,7 +195,8 @@ namespace OpenSim.Services.HypergridService | |||
182 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID); | 195 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID); |
183 | 196 | ||
184 | // Let's find out the local root folder | 197 | // Let's find out the local root folder |
185 | XInventoryFolder root = GetRootXFolder(principalID); ; | 198 | XInventoryFolder root = GetRootXFolder(principalID); |
199 | |||
186 | if (root == null) | 200 | if (root == null) |
187 | { | 201 | { |
188 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve local root folder for user {0}", principalID); | 202 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve local root folder for user {0}", principalID); |
@@ -255,6 +269,13 @@ namespace OpenSim.Services.HypergridService | |||
255 | { | 269 | { |
256 | //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type); | 270 | //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type); |
257 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | 271 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); |
272 | |||
273 | if (suitcase == null) | ||
274 | { | ||
275 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for child type folder {1}", principalID, type); | ||
276 | return null; | ||
277 | } | ||
278 | |||
258 | XInventoryFolder[] folders = m_Database.GetFolders( | 279 | XInventoryFolder[] folders = m_Database.GetFolders( |
259 | new string[] { "agentID", "type", "parentFolderID" }, | 280 | new string[] { "agentID", "type", "parentFolderID" }, |
260 | new string[] { principalID.ToString(), ((int)type).ToString(), suitcase.folderID.ToString() }); | 281 | new string[] { principalID.ToString(), ((int)type).ToString(), suitcase.folderID.ToString() }); |
@@ -546,6 +567,7 @@ namespace OpenSim.Services.HypergridService | |||
546 | private bool IsWithinSuitcaseTree(UUID principalID, UUID folderID) | 567 | private bool IsWithinSuitcaseTree(UUID principalID, UUID folderID) |
547 | { | 568 | { |
548 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | 569 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); |
570 | |||
549 | if (suitcase == null) | 571 | if (suitcase == null) |
550 | { | 572 | { |
551 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder", principalID); | 573 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder", principalID); |