From b46a9cf57fa9e7302a6505d0f86c0a027c67980f Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 8 Feb 2013 02:45:30 +0000 Subject: [PATCH] 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. --- .../CoalescedSceneObjectsSerializer.cs | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index a4f730d375..5cb271ddad 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs @@ -42,9 +42,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization /// /// Serialize and deserialize coalesced scene objects. /// - /// - /// Deserialization not yet here. - /// public class CoalescedSceneObjectsSerializer { 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); coa = null; + int i = 0; using (StringReader sr = new StringReader(xml)) { @@ -153,7 +151,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization if (reader.Name == "SceneObjectGroup") { 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++; } }