From 312e1457dd576bc61ac2fd2e104813dd86134c4d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 3 Feb 2012 23:47:01 +0000
Subject: Change SceneObjectSerializer to use common
ExternalRepresentationUtils.ExecuteReadProcessors() methods.
Adds ability to submit a customized exception message to match logging.
---
.../External/ExternalRepresentationUtils.cs | 37 ++++++++++++++++------
1 file changed, 28 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Framework/Serialization')
diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
index 39a9f37..a392af6 100644
--- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
+++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
@@ -47,15 +47,36 @@ namespace OpenSim.Framework.Serialization.External
/// Populate a node with data read from xml using a dictinoary of processors
///
///
- ///
- /// A
- ///
- ///
- /// A
- ///
+ /// /param>
+ ///
public static void ExecuteReadProcessors(
NodeType nodeToFill, Dictionary> processors, XmlTextReader xtr)
{
+ ExecuteReadProcessors(
+ nodeToFill,
+ processors,
+ xtr,
+ (o, name, e)
+ => m_log.ErrorFormat(
+ "[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}",
+ name, e.Message, e.StackTrace));
+ }
+
+ ///
+ /// Populate a node with data read from xml using a dictinoary of processors
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Action to take if there is a parsing problem. This will usually just be to log the exception
+ ///
+ public static void ExecuteReadProcessors(
+ NodeType nodeToFill,
+ Dictionary> processors,
+ XmlTextReader xtr,
+ Action parseExceptionAction)
+ {
string nodeName = string.Empty;
while (xtr.NodeType != XmlNodeType.EndElement)
{
@@ -74,9 +95,7 @@ namespace OpenSim.Framework.Serialization.External
}
catch (Exception e)
{
- m_log.ErrorFormat(
- "[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}",
- nodeName, e.Message, e.StackTrace);
+ parseExceptionAction(nodeToFill, nodeName, e);
if (xtr.NodeType == XmlNodeType.EndElement)
xtr.Read();
--
cgit v1.1