aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorSean Dague2007-12-08 14:27:12 +0000
committerSean Dague2007-12-08 14:27:12 +0000
commit0855066968e30a9965088c14234b2bc93daf0481 (patch)
tree9f2a0c9a520af4bfa53fd3aa1ae651f0130bd5bb /OpenSim/Framework
parentset svn:eol-style (diff)
downloadopensim-SC_OLD-0855066968e30a9965088c14234b2bc93daf0481.zip
opensim-SC_OLD-0855066968e30a9965088c14234b2bc93daf0481.tar.gz
opensim-SC_OLD-0855066968e30a9965088c14234b2bc93daf0481.tar.bz2
opensim-SC_OLD-0855066968e30a9965088c14234b2bc93daf0481.tar.xz
This patch fixes mantis 105. Basically, it stops the index exception when
no root folder is found and it makes the user server wait longer for the inventory server to do its work. From Justin Casey (IBM)
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs15
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs16
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs26
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs27
-rw-r--r--OpenSim/Framework/InventoryItemBase.cs4
5 files changed, 48 insertions, 40 deletions
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index 091d829..e86eaac 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -82,10 +82,12 @@ namespace OpenSim.Framework.Communications
82 /// <returns></returns> 82 /// <returns></returns>
83 public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID) 83 public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
84 { 84 {
85 List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>(); 85 List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
86 InventoryFolderBase rootFolder = null;
87
86 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) 88 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
87 { 89 {
88 InventoryFolderBase rootFolder = plugin.Value.getUserRootFolder(userID); 90 rootFolder = plugin.Value.getUserRootFolder(userID);
89 if (rootFolder != null) 91 if (rootFolder != null)
90 { 92 {
91 inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID); 93 inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID);
@@ -93,6 +95,13 @@ namespace OpenSim.Framework.Communications
93 return inventoryList; 95 return inventoryList;
94 } 96 }
95 } 97 }
98
99 if (null == rootFolder)
100 {
101 MainLog.Instance.Warn(
102 "INVENTORY", "Could not find a root folder belonging to user with ID " + userID);
103 }
104
96 return inventoryList; 105 return inventoryList;
97 } 106 }
98 107
@@ -235,4 +244,4 @@ namespace OpenSim.Framework.Communications
235 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); 244 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
236 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); 245 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
237 } 246 }
238} \ No newline at end of file 247}
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
index 364e0f2..cd0470c 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
@@ -201,11 +201,7 @@ namespace OpenSim.Framework.Data.MSSQL
201 } 201 }
202 } 202 }
203 203
204 /// <summary> 204 // see InventoryItemBase.getUserRootFolder
205 /// Returns the users inventory root folder.
206 /// </summary>
207 /// <param name="user"></param>
208 /// <returns></returns>
209 public InventoryFolderBase getUserRootFolder(LLUUID user) 205 public InventoryFolderBase getUserRootFolder(LLUUID user)
210 { 206 {
211 try 207 try
@@ -224,8 +220,14 @@ namespace OpenSim.Framework.Data.MSSQL
224 items.Add(readInventoryFolder(reader)); 220 items.Add(readInventoryFolder(reader));
225 221
226 InventoryFolderBase rootFolder = null; 222 InventoryFolderBase rootFolder = null;
223
224 // There should only ever be one root folder for a user. However, if there's more
225 // than one we'll simply use the first one rather than failing. It would be even
226 // nicer to print some message to this effect, but this feels like it's too low a
227 // to put such a message out, and it's too minor right now to spare the time to
228 // suitably refactor.
227 if (items.Count > 0) { 229 if (items.Count > 0) {
228 rootFolder = items[0]; //should only be one folder with parent set to zero (the root one). 230 rootFolder = items[0];
229 } 231 }
230 232
231 reader.Close(); 233 reader.Close();
@@ -694,4 +696,4 @@ namespace OpenSim.Framework.Data.MSSQL
694 } 696 }
695 } 697 }
696 } 698 }
697} \ No newline at end of file 699}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
index 7c86e2c..4020cc1 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
@@ -211,11 +211,7 @@ namespace OpenSim.Framework.Data.MySQL
211 } 211 }
212 } 212 }
213 213
214 /// <summary> 214 // see InventoryItemBase.getUserRootFolder
215 /// Returns the users inventory root folder.
216 /// </summary>
217 /// <param name="user"></param>
218 /// <returns></returns>
219 public InventoryFolderBase getUserRootFolder(LLUUID user) 215 public InventoryFolderBase getUserRootFolder(LLUUID user)
220 { 216 {
221 try 217 try
@@ -234,9 +230,19 @@ namespace OpenSim.Framework.Data.MySQL
234 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 230 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
235 while (reader.Read()) 231 while (reader.Read())
236 items.Add(readInventoryFolder(reader)); 232 items.Add(readInventoryFolder(reader));
233
234 InventoryFolderBase rootFolder = null;
235
236 // There should only ever be one root folder for a user. However, if there's more
237 // than one we'll simply use the first one rather than failing. It would be even
238 // nicer to print some message to this effect, but this feels like it's too low a
239 // to put such a message out, and it's too minor right now to spare the time to
240 // suitably refactor.
241 if (items.Count > 0)
242 {
243 rootFolder = items[0];
244 }
237 245
238 InventoryFolderBase rootFolder = items[0];
239 //should only be one folder with parent set to zero (the root one).
240 reader.Close(); 246 reader.Close();
241 result.Dispose(); 247 result.Dispose();
242 248
@@ -252,7 +258,9 @@ namespace OpenSim.Framework.Data.MySQL
252 } 258 }
253 259
254 /// <summary> 260 /// <summary>
255 /// Returns a list of folders in a users inventory contained within the specified folder 261 /// Return a list of folders in a users inventory contained within the specified folder.
262 /// This method is only used in tests - in normal operation the user always have one,
263 /// and only one, root folder.
256 /// </summary> 264 /// </summary>
257 /// <param name="parentID">The folder to search</param> 265 /// <param name="parentID">The folder to search</param>
258 /// <returns>A list of inventory folders</returns> 266 /// <returns>A list of inventory folders</returns>
@@ -605,4 +613,4 @@ namespace OpenSim.Framework.Data.MySQL
605 } 613 }
606 } 614 }
607 } 615 }
608} \ No newline at end of file 616}
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index 5e95878..94084a6 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -226,11 +226,7 @@ namespace OpenSim.Framework.Data.SQLite
226 return new List<InventoryFolderBase>(); 226 return new List<InventoryFolderBase>();
227 } 227 }
228 228
229 /// <summary> 229 // see InventoryItemBase.getUserRootFolder
230 /// Returns the users inventory root folder.
231 /// </summary>
232 /// <param name="user">The UUID of the user who is having inventory being returned</param>
233 /// <returns>Root inventory folder</returns>
234 public InventoryFolderBase getUserRootFolder(LLUUID user) 230 public InventoryFolderBase getUserRootFolder(LLUUID user)
235 { 231 {
236 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 232 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
@@ -242,22 +238,15 @@ namespace OpenSim.Framework.Data.SQLite
242 folders.Add(buildFolder(row)); 238 folders.Add(buildFolder(row));
243 } 239 }
244 240
245 if (folders.Count == 1) 241 // There should only ever be one root folder for a user. However, if there's more
242 // than one we'll simply use the first one rather than failing. It would be even
243 // nicer to print some message to this effect, but this feels like it's too low a
244 // to put such a message out, and it's too minor right now to spare the time to
245 // suitably refactor.
246 if (folders.Count > 1)
246 { 247 {
247 //we found the root
248 //System.Console.WriteLine("found root inventory folder");
249 return folders[0]; 248 return folders[0];
250 } 249 }
251 else if (folders.Count > 1)
252 {
253 //err shouldn't be more than one root
254 //System.Console.WriteLine("found more than one root inventory folder");
255 }
256 else if (folders.Count == 0)
257 {
258 // no root?
259 //System.Console.WriteLine("couldn't find root inventory folder");
260 }
261 250
262 return null; 251 return null;
263 } 252 }
@@ -608,4 +597,4 @@ namespace OpenSim.Framework.Data.SQLite
608 return true; 597 return true;
609 } 598 }
610 } 599 }
611} \ No newline at end of file 600}
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs
index 0ee30bb..b9a11c9 100644
--- a/OpenSim/Framework/InventoryItemBase.cs
+++ b/OpenSim/Framework/InventoryItemBase.cs
@@ -184,7 +184,7 @@ namespace OpenSim.Framework
184 /// Returns the users inventory root folder. 184 /// Returns the users inventory root folder.
185 /// </summary> 185 /// </summary>
186 /// <param name="user">The UUID of the user who is having inventory being returned</param> 186 /// <param name="user">The UUID of the user who is having inventory being returned</param>
187 /// <returns>Root inventory folder</returns> 187 /// <returns>Root inventory folder, null if no root inventory folder was found</returns>
188 InventoryFolderBase getUserRootFolder(LLUUID user); 188 InventoryFolderBase getUserRootFolder(LLUUID user);
189 189
190 /// <summary> 190 /// <summary>
@@ -285,4 +285,4 @@ namespace OpenSim.Framework
285 285
286 [XmlElement(ElementName = "folder", IsNullable = true)] public SerializableFolder root; 286 [XmlElement(ElementName = "folder", IsNullable = true)] public SerializableFolder root;
287 } 287 }
288} \ No newline at end of file 288}