If a component of a coalesced object fails to deserialization, do not add a null where the object should be.

This prevents a later load IAR failure.
This code is currently only used by IAR loading.
0.7.4-extended
Justin Clark-Casey (justincc) 2013-02-08 02:45:30 +00:00
parent aab719dc18
commit b46a9cf57f
1 changed files with 18 additions and 4 deletions

View File

@ -42,9 +42,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
/// <summary> /// <summary>
/// Serialize and deserialize coalesced scene objects. /// Serialize and deserialize coalesced scene objects.
/// </summary> /// </summary>
/// <remarks>
/// Deserialization not yet here.
/// </remarks>
public class CoalescedSceneObjectsSerializer public class CoalescedSceneObjectsSerializer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -128,6 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); // m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml);
coa = null; coa = null;
int i = 0;
using (StringReader sr = new StringReader(xml)) using (StringReader sr = new StringReader(xml))
{ {
@ -153,7 +151,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
if (reader.Name == "SceneObjectGroup") if (reader.Name == "SceneObjectGroup")
{ {
string soXml = reader.ReadOuterXml(); string soXml = reader.ReadOuterXml();
coa.Add(SceneObjectSerializer.FromOriginalXmlFormat(soXml));
SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(soXml);
if (so != null)
{
coa.Add(so);
}
else
{
// XXX: Possibly we should fail outright here rather than continuing if a particular component of the
// coalesced object fails to load.
m_log.WarnFormat(
"[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.",
i);
}
i++;
} }
} }