Added inner exception handling in Shape deserialization processing, so that the whole Shape processing returns a valid Shape object.

viewer-2-initial-appearance
Diva Canto 2010-10-23 20:39:41 -07:00
parent 80f90229e5
commit 627d1a42fe
1 changed files with 16 additions and 3 deletions

View File

@ -1426,7 +1426,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
reader.ReadStartElement(name); reader.ReadStartElement(name);
vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x
vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or Y vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or y
vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z
reader.ReadEndElement(); reader.ReadEndElement();
@ -1501,15 +1501,28 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
reader.ReadStartElement(name, String.Empty); // Shape reader.ReadStartElement(name, String.Empty); // Shape
string nodeName = string.Empty;
while (reader.NodeType != XmlNodeType.EndElement) while (reader.NodeType != XmlNodeType.EndElement)
{ {
nodeName = reader.Name;
//m_log.DebugFormat("[XXX] Processing: {0}", reader.Name); //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
ShapeXmlProcessor p = null; ShapeXmlProcessor p = null;
if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p)) if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p))
p(shape, reader); {
try
{
p(shape, reader);
}
catch (Exception e)
{
m_log.DebugFormat("[SceneObjectSerializer]: exception while parsing Shape {0}: {1}", nodeName, e);
if (reader.NodeType == XmlNodeType.EndElement)
reader.Read();
}
}
else else
{ {
// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name); // m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name);
reader.ReadOuterXml(); reader.ReadOuterXml();
} }
} }