From 2b842958cc172fbf9ee79b495a268f012fb47cdc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 16 Feb 2012 02:58:00 +0000 Subject: If shape properties fail SOP parsing (e.g. due to commas instead of decimal points) print out one short message listing the failing node names rather than lots of exceptions. Adds skeleton bad float values deserialization test --- .../Scenes/Serialization/SceneObjectSerializer.cs | 34 ++++++++++++++-------- 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 0a32214..e6b88a3 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Drawing; using System.IO; +using System.Linq; using System.Reflection; using System.Xml; using log4net; @@ -570,13 +571,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) { - bool errors = false; - obj.Shape = ReadShape(reader, "Shape", out errors); + List errorNodeNames; + obj.Shape = ReadShape(reader, "Shape", out errorNodeNames); - if (errors) + if (errorNodeNames != null) + { m_log.DebugFormat( - "[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors. Please see earlier log entries.", - obj.Name, obj.UUID); + "[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors in properties {2}.", + obj.Name, obj.UUID, string.Join(", ", errorNodeNames.ToArray())); + } } private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) @@ -1519,37 +1522,44 @@ namespace OpenSim.Region.Framework.Scenes.Serialization /// /// /// The name of the xml element containing the shape - /// true if any errors were encountered during parsing, false otherwise + /// a list containing the failing node names. If no failures then null. /// The shape parsed - public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out bool errors) + public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out List errorNodeNames) { - errors = false; + List internalErrorNodeNames = null; PrimitiveBaseShape shape = new PrimitiveBaseShape(); if (reader.IsEmptyElement) { reader.Read(); + errorNodeNames = null; return shape; } reader.ReadStartElement(name, String.Empty); // Shape - errors = ExternalRepresentationUtils.ExecuteReadProcessors( + ExternalRepresentationUtils.ExecuteReadProcessors( shape, m_ShapeXmlProcessors, reader, (o, nodeName, e) => { - m_log.DebugFormat( - "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", - nodeName, e.Message, e.StackTrace); +// m_log.DebugFormat( +// "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", +// nodeName, e.Message, e.StackTrace); + if (internalErrorNodeNames == null) + internalErrorNodeNames = new List(); + + internalErrorNodeNames.Add(nodeName); } ); reader.ReadEndElement(); // Shape + errorNodeNames = internalErrorNodeNames; + return shape; } -- cgit v1.1