From ef50e6875c40f420eaa4309c9788e0c9301e155b Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Sat, 19 Jan 2008 11:08:07 +0000 Subject: Still looking for that startup crash bug. Added some exception handling in prim object load. --- OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | 111 +++++++++++++------------ 1 file changed, 59 insertions(+), 52 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index 50623df..cadd9fc 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs @@ -215,77 +215,84 @@ namespace OpenSim.Framework.Data.MySQL DataTable prims = m_primTable; DataTable shapes = m_shapeTable; - string byRegion = "RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'"; - string orderByParent = "ParentID ASC"; - - lock (m_dataSet) + try { - DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); - MainLog.Instance.Verbose("DATASTORE", - "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); + string byRegion = "RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'"; + string orderByParent = "ParentID ASC"; - foreach (DataRow primRow in primsForRegion) + lock (m_dataSet) { - try + DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); + MainLog.Instance.Verbose("DATASTORE", + "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); + + foreach (DataRow primRow in primsForRegion) { - string uuid = (string) primRow["UUID"]; - string objID = (string) primRow["SceneGroupID"]; - - SceneObjectPart prim = buildPrim(primRow); - - if (uuid == objID) //is new SceneObjectGroup ? + try { - SceneObjectGroup group = new SceneObjectGroup(); - - DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); - if (shapeRow != null) + string uuid = (string)primRow["UUID"]; + string objID = (string)primRow["SceneGroupID"]; + + SceneObjectPart prim = buildPrim(primRow); + + if (uuid == objID) //is new SceneObjectGroup ? { - prim.Shape = buildShape(shapeRow); + SceneObjectGroup group = new SceneObjectGroup(); + + DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); + if (shapeRow != null) + { + prim.Shape = buildShape(shapeRow); + } + else + { + MainLog.Instance.Notice( + "No shape found for prim in storage, so setting default box shape"); + prim.Shape = PrimitiveBaseShape.Default; + } + group.AddPart(prim); + group.RootPart = prim; + + createdObjects.Add(group.UUID, group); + retvals.Add(group); } else { - MainLog.Instance.Notice( - "No shape found for prim in storage, so setting default box shape"); - prim.Shape = PrimitiveBaseShape.Default; + DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); + if (shapeRow != null) + { + prim.Shape = buildShape(shapeRow); + } + else + { + MainLog.Instance.Notice( + "No shape found for prim in storage, so setting default box shape"); + prim.Shape = PrimitiveBaseShape.Default; + } + createdObjects[new LLUUID(objID)].AddPart(prim); } - group.AddPart(prim); - group.RootPart = prim; - createdObjects.Add(group.UUID, group); - retvals.Add(group); - } - else - { - DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); - if (shapeRow != null) + if (persistPrimInventories) { - prim.Shape = buildShape(shapeRow); + LoadItems(prim); } - else - { - MainLog.Instance.Notice( - "No shape found for prim in storage, so setting default box shape"); - prim.Shape = PrimitiveBaseShape.Default; - } - createdObjects[new LLUUID(objID)].AddPart(prim); } - - if (persistPrimInventories) - { - LoadItems(prim); - } - } - catch (Exception e) - { - MainLog.Instance.Error("DATASTORE", "Failed create prim object, exception and data follows"); - MainLog.Instance.Verbose("DATASTORE", e.ToString()); - foreach (DataColumn col in prims.Columns) + catch (Exception e) { - MainLog.Instance.Verbose("DATASTORE", "Col: " + col.ColumnName + " => " + primRow[col]); + MainLog.Instance.Error("DATASTORE", "Failed create prim object, exception and data follows"); + MainLog.Instance.Verbose("DATASTORE", e.ToString()); + foreach (DataColumn col in prims.Columns) + { + MainLog.Instance.Verbose("DATASTORE", "Col: " + col.ColumnName + " => " + primRow[col]); + } } } } } + catch (Exception ex) + { + MainLog.Instance.Error("DATASTORE", "Exception trying to load prim objects: " + ex.ToString()); + } return retvals; } -- cgit v1.1