From 49d80f5711e1bc1afb6c650038619ade6d9a9e97 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 11 Apr 2011 23:07:56 +0100 Subject: Include code to return more information about the NullReferenceException seen in http://opensimulator.org/mantis/view.php?id=5403 prior to doing something about it. --- OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 8efe4e9..50b6dbe 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs @@ -39,6 +39,8 @@ namespace OpenSim.Data.MySQL { public class MySQLGenericTableHandler : MySqlFramework where T: class, new() { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + protected Dictionary m_Fields = new Dictionary(); @@ -217,7 +219,6 @@ namespace OpenSim.Data.MySQL { using (MySqlCommand cmd = new MySqlCommand()) { - string query = ""; List names = new List(); List values = new List(); @@ -226,6 +227,16 @@ namespace OpenSim.Data.MySQL { names.Add(fi.Name); values.Add("?" + fi.Name); + + // Temporarily return more information about what field is unexpectedly null for + // http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the + // InventoryTransferModule or we may be required to substitute a DBNull here. + if (fi.GetValue(row) == null) + throw new NullReferenceException( + string.Format( + "[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null", + fi.Name, row)); + cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString()); } @@ -268,4 +279,4 @@ namespace OpenSim.Data.MySQL } } } -} +} \ No newline at end of file -- cgit v1.1 From da4a9653a27cbb1ecc779774a3d8715afb079086 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Apr 2011 22:33:06 +0100 Subject: minor: remove some mono compiler warnings --- OpenSim/Data/Null/NullEstateData.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/Null/NullEstateData.cs b/OpenSim/Data/Null/NullEstateData.cs index 0cebff5..8db8064 100755 --- a/OpenSim/Data/Null/NullEstateData.cs +++ b/OpenSim/Data/Null/NullEstateData.cs @@ -38,9 +38,9 @@ namespace OpenSim.Data.Null { public class NullEstateStore : IEstateDataStore { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private string m_connectionString; +// private string m_connectionString; protected virtual Assembly Assembly { @@ -58,7 +58,7 @@ namespace OpenSim.Data.Null public void Initialise(string connectionString) { - m_connectionString = connectionString; +// m_connectionString = connectionString; } private string[] FieldList -- cgit v1.1