aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-04-11 23:07:56 +0100
committerJustin Clark-Casey (justincc)2011-04-11 23:07:56 +0100
commit49d80f5711e1bc1afb6c650038619ade6d9a9e97 (patch)
tree08ab8dcbc15e0cd4f38f67896302161739cfabec /OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
parentminor: remove now inaccurate comment (diff)
downloadopensim-SC_OLD-49d80f5711e1bc1afb6c650038619ade6d9a9e97.zip
opensim-SC_OLD-49d80f5711e1bc1afb6c650038619ade6d9a9e97.tar.gz
opensim-SC_OLD-49d80f5711e1bc1afb6c650038619ade6d9a9e97.tar.bz2
opensim-SC_OLD-49d80f5711e1bc1afb6c650038619ade6d9a9e97.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLGenericTableHandler.cs15
1 files changed, 13 insertions, 2 deletions
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
39{ 39{
40 public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new() 40 public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new()
41 { 41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
42 protected Dictionary<string, FieldInfo> m_Fields = 44 protected Dictionary<string, FieldInfo> m_Fields =
43 new Dictionary<string, FieldInfo>(); 45 new Dictionary<string, FieldInfo>();
44 46
@@ -217,7 +219,6 @@ namespace OpenSim.Data.MySQL
217 { 219 {
218 using (MySqlCommand cmd = new MySqlCommand()) 220 using (MySqlCommand cmd = new MySqlCommand())
219 { 221 {
220
221 string query = ""; 222 string query = "";
222 List<String> names = new List<String>(); 223 List<String> names = new List<String>();
223 List<String> values = new List<String>(); 224 List<String> values = new List<String>();
@@ -226,6 +227,16 @@ namespace OpenSim.Data.MySQL
226 { 227 {
227 names.Add(fi.Name); 228 names.Add(fi.Name);
228 values.Add("?" + fi.Name); 229 values.Add("?" + fi.Name);
230
231 // Temporarily return more information about what field is unexpectedly null for
232 // http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the
233 // InventoryTransferModule or we may be required to substitute a DBNull here.
234 if (fi.GetValue(row) == null)
235 throw new NullReferenceException(
236 string.Format(
237 "[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null",
238 fi.Name, row));
239
229 cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString()); 240 cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString());
230 } 241 }
231 242
@@ -268,4 +279,4 @@ namespace OpenSim.Data.MySQL
268 } 279 }
269 } 280 }
270 } 281 }
271} 282} \ No newline at end of file