From 2b23734a1646fc60658d467c7f2b5d90675b47a4 Mon Sep 17 00:00:00 2001
From: Sean Dague
Date: Mon, 7 Apr 2008 15:01:00 +0000
Subject: add some error messages for abuse of our IInventoryData interface
(i.e. using add to update, or update to add).
---
OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Data')
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index aa56121..1554aa3 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -126,7 +126,7 @@ namespace OpenSim.Data.SQLite
row["inventoryEveryOnePermissions"] = item.inventoryEveryOnePermissions;
}
- private void addFolder(InventoryFolderBase folder)
+ private void addFolder(InventoryFolderBase folder, bool add)
{
lock (ds)
{
@@ -135,12 +135,18 @@ namespace OpenSim.Data.SQLite
DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.folderID));
if (inventoryRow == null)
{
+ if (! add)
+ m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory folder: {0}", folder.folderID);
+
inventoryRow = inventoryFolderTable.NewRow();
fillFolderRow(inventoryRow, folder);
inventoryFolderTable.Rows.Add(inventoryRow);
}
else
{
+ if (add)
+ m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory folder that already exists: {0}", folder.folderID);
+
fillFolderRow(inventoryRow, folder);
}
@@ -170,7 +176,7 @@ namespace OpenSim.Data.SQLite
}
}
- private void addItem(InventoryItemBase item)
+ private void addItem(InventoryItemBase item, bool add)
{
lock (ds)
{
@@ -179,12 +185,18 @@ namespace OpenSim.Data.SQLite
DataRow inventoryRow = inventoryItemTable.Rows.Find(Util.ToRawUuidString(item.inventoryID));
if (inventoryRow == null)
{
+ if (! add)
+ m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory item: {0}", item.inventoryID);
+
inventoryRow = inventoryItemTable.NewRow();
fillItemRow(inventoryRow, item);
inventoryItemTable.Rows.Add(inventoryRow);
}
else
{
+ if (add)
+ m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory item that already exists: {0}", item.inventoryID);
+
fillItemRow(inventoryRow, item);
}
invItemsDa.Update(ds, "inventoryitems");
@@ -385,7 +397,7 @@ namespace OpenSim.Data.SQLite
/// The item to be created
public void addInventoryItem(InventoryItemBase item)
{
- addItem(item);
+ addItem(item, true);
}
///
@@ -394,7 +406,7 @@ namespace OpenSim.Data.SQLite
/// The updated item
public void updateInventoryItem(InventoryItemBase item)
{
- addItem(item);
+ addItem(item, false);
}
///
@@ -436,7 +448,7 @@ namespace OpenSim.Data.SQLite
/// The inventory folder
public void addInventoryFolder(InventoryFolderBase folder)
{
- addFolder(folder);
+ addFolder(folder, true);
}
///
@@ -445,7 +457,7 @@ namespace OpenSim.Data.SQLite
/// The inventory folder
public void updateInventoryFolder(InventoryFolderBase folder)
{
- addFolder(folder);
+ addFolder(folder, false);
}
///
--
cgit v1.1