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.bulletsim
parent
64dc7e9f14
commit
49d80f5711
|
@ -39,6 +39,8 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new()
|
public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new()
|
||||||
{
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected Dictionary<string, FieldInfo> m_Fields =
|
protected Dictionary<string, FieldInfo> m_Fields =
|
||||||
new Dictionary<string, FieldInfo>();
|
new Dictionary<string, FieldInfo>();
|
||||||
|
|
||||||
|
@ -217,7 +219,6 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
{
|
{
|
||||||
|
|
||||||
string query = "";
|
string query = "";
|
||||||
List<String> names = new List<String>();
|
List<String> names = new List<String>();
|
||||||
List<String> values = new List<String>();
|
List<String> values = new List<String>();
|
||||||
|
@ -226,6 +227,16 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
names.Add(fi.Name);
|
names.Add(fi.Name);
|
||||||
values.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());
|
cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue