diff options
author | Justin Clark-Casey (justincc) | 2012-02-16 02:58:00 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-02-16 02:58:00 +0000 |
commit | 2b842958cc172fbf9ee79b495a268f012fb47cdc (patch) | |
tree | 5d9e5f2374df7b15a4b77310afe4b1b5bef7ac40 /OpenSim/Region/Framework | |
parent | Correct a bug introduced in 1f402fdf (Feb 7 2012) where the delete friends gr... (diff) | |
download | opensim-SC_OLD-2b842958cc172fbf9ee79b495a268f012fb47cdc.zip opensim-SC_OLD-2b842958cc172fbf9ee79b495a268f012fb47cdc.tar.gz opensim-SC_OLD-2b842958cc172fbf9ee79b495a268f012fb47cdc.tar.bz2 opensim-SC_OLD-2b842958cc172fbf9ee79b495a268f012fb47cdc.tar.xz |
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
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 34 |
1 files changed, 22 insertions, 12 deletions
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; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Drawing; | 30 | using System.Drawing; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Linq; | ||
32 | using System.Reflection; | 33 | using System.Reflection; |
33 | using System.Xml; | 34 | using System.Xml; |
34 | using log4net; | 35 | using log4net; |
@@ -570,13 +571,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
570 | 571 | ||
571 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) | 572 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) |
572 | { | 573 | { |
573 | bool errors = false; | 574 | List<string> errorNodeNames; |
574 | obj.Shape = ReadShape(reader, "Shape", out errors); | 575 | obj.Shape = ReadShape(reader, "Shape", out errorNodeNames); |
575 | 576 | ||
576 | if (errors) | 577 | if (errorNodeNames != null) |
578 | { | ||
577 | m_log.DebugFormat( | 579 | m_log.DebugFormat( |
578 | "[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors. Please see earlier log entries.", | 580 | "[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors in properties {2}.", |
579 | obj.Name, obj.UUID); | 581 | obj.Name, obj.UUID, string.Join(", ", errorNodeNames.ToArray())); |
582 | } | ||
580 | } | 583 | } |
581 | 584 | ||
582 | private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) | 585 | private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) |
@@ -1519,37 +1522,44 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1519 | /// </summary> | 1522 | /// </summary> |
1520 | /// <param name="reader"></param> | 1523 | /// <param name="reader"></param> |
1521 | /// <param name="name">The name of the xml element containing the shape</param> | 1524 | /// <param name="name">The name of the xml element containing the shape</param> |
1522 | /// <param name="errors">true if any errors were encountered during parsing, false otherwise</param> | 1525 | /// <param name="errors">a list containing the failing node names. If no failures then null.</param> |
1523 | /// <returns>The shape parsed</returns> | 1526 | /// <returns>The shape parsed</returns> |
1524 | public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out bool errors) | 1527 | public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out List<string> errorNodeNames) |
1525 | { | 1528 | { |
1526 | errors = false; | 1529 | List<string> internalErrorNodeNames = null; |
1527 | 1530 | ||
1528 | PrimitiveBaseShape shape = new PrimitiveBaseShape(); | 1531 | PrimitiveBaseShape shape = new PrimitiveBaseShape(); |
1529 | 1532 | ||
1530 | if (reader.IsEmptyElement) | 1533 | if (reader.IsEmptyElement) |
1531 | { | 1534 | { |
1532 | reader.Read(); | 1535 | reader.Read(); |
1536 | errorNodeNames = null; | ||
1533 | return shape; | 1537 | return shape; |
1534 | } | 1538 | } |
1535 | 1539 | ||
1536 | reader.ReadStartElement(name, String.Empty); // Shape | 1540 | reader.ReadStartElement(name, String.Empty); // Shape |
1537 | 1541 | ||
1538 | errors = ExternalRepresentationUtils.ExecuteReadProcessors( | 1542 | ExternalRepresentationUtils.ExecuteReadProcessors( |
1539 | shape, | 1543 | shape, |
1540 | m_ShapeXmlProcessors, | 1544 | m_ShapeXmlProcessors, |
1541 | reader, | 1545 | reader, |
1542 | (o, nodeName, e) | 1546 | (o, nodeName, e) |
1543 | => | 1547 | => |
1544 | { | 1548 | { |
1545 | m_log.DebugFormat( | 1549 | // m_log.DebugFormat( |
1546 | "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", | 1550 | // "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", |
1547 | nodeName, e.Message, e.StackTrace); | 1551 | // nodeName, e.Message, e.StackTrace); |
1552 | if (internalErrorNodeNames == null) | ||
1553 | internalErrorNodeNames = new List<string>(); | ||
1554 | |||
1555 | internalErrorNodeNames.Add(nodeName); | ||
1548 | } | 1556 | } |
1549 | ); | 1557 | ); |
1550 | 1558 | ||
1551 | reader.ReadEndElement(); // Shape | 1559 | reader.ReadEndElement(); // Shape |
1552 | 1560 | ||
1561 | errorNodeNames = internalErrorNodeNames; | ||
1562 | |||
1553 | return shape; | 1563 | return shape; |
1554 | } | 1564 | } |
1555 | 1565 | ||