Still looking for that startup crash bug. Added some exception handling in prim object load.

ThreadPoolClientBranch
Tedd Hansen 2008-01-19 11:08:07 +00:00
parent 8fdeab57b1
commit ef50e6875c
1 changed files with 62 additions and 55 deletions

View File

@ -215,77 +215,84 @@ namespace OpenSim.Framework.Data.MySQL
DataTable prims = m_primTable; DataTable prims = m_primTable;
DataTable shapes = m_shapeTable; DataTable shapes = m_shapeTable;
string byRegion = "RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'"; try
string orderByParent = "ParentID ASC";
lock (m_dataSet)
{ {
DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); string byRegion = "RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'";
MainLog.Instance.Verbose("DATASTORE", string orderByParent = "ParentID ASC";
"Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
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"]; try
string objID = (string) primRow["SceneGroupID"];
SceneObjectPart prim = buildPrim(primRow);
if (uuid == objID) //is new SceneObjectGroup ?
{ {
SceneObjectGroup group = new SceneObjectGroup(); string uuid = (string)primRow["UUID"];
string objID = (string)primRow["SceneGroupID"];
DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); SceneObjectPart prim = buildPrim(primRow);
if (shapeRow != null)
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 else
{ {
MainLog.Instance.Notice( DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID));
"No shape found for prim in storage, so setting default box shape"); if (shapeRow != null)
prim.Shape = PrimitiveBaseShape.Default; {
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); if (persistPrimInventories)
retvals.Add(group);
}
else
{
DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID));
if (shapeRow != null)
{ {
prim.Shape = buildShape(shapeRow); LoadItems(prim);
} }
else }
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)
{ {
MainLog.Instance.Notice( MainLog.Instance.Verbose("DATASTORE", "Col: " + col.ColumnName + " => " + primRow[col]);
"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)
{
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; return retvals;
} }