From 13e51b197cb842de916645c5e4b4d2d2898b8f00 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 1 May 2008 13:41:36 +0000 Subject: * Add more class cast exceptions to mysql read inventory item to cover all new fields - not just those I think are initially failing. * This is more likely to allow existing mysql databases to work temporarily, if the previous revision doesn't work --- OpenSim/Data/MySQL/MySQLInventoryData.cs | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 991e9c7..592ade9 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs @@ -343,7 +343,14 @@ namespace OpenSim.Data.MySQL m_log.WarnFormat("Could not cast salePrice {0} to {1}", reader["salePrice"], "int"); } - item.SaleType = Convert.ToByte(reader["saleType"]); + try + { + item.SaleType = Convert.ToByte(reader["saleType"]); + } + catch (InvalidCastException) + { + m_log.WarnFormat("Could not convert saleType {0} to {1}", reader["saleType"], "byte"); + } try { @@ -354,8 +361,24 @@ namespace OpenSim.Data.MySQL m_log.WarnFormat("Could not cast creationDate {0} to {1}", reader["creationDate"], "int"); } - item.GroupID = new LLUUID(reader["groupID"].ToString()); - item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); + try + { + item.GroupID = new LLUUID(reader["groupID"].ToString()); + } + catch (Exception) + { + item.GroupID = LLUUID.Zero; + m_log.WarnFormat("Could not convert groupID {0} to {1}", reader["groupID"], "LLUUID"); + } + + try + { + item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); + } + catch (InvalidCastException) + { + m_log.WarnFormat("Could not cast groupOwned {0} to {1}", reader["groupOwned"], "boolean"); + } try { -- cgit v1.1