try to work around missing BOM
parent
e308ab8843
commit
aca5728ab2
|
@ -30,6 +30,7 @@ using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
@ -129,9 +130,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Quickly check if this is a coalesced object, without fully parsing the XML
|
// Quickly check if this is a coalesced object, without fully parsing the XML
|
||||||
using (StringReader sr = new StringReader(xml))
|
using (XmlTextReader reader = new XmlTextReader(new StringReader(xml)))
|
||||||
{
|
|
||||||
using (XmlTextReader reader = new XmlTextReader(sr))
|
|
||||||
{
|
{
|
||||||
reader.MoveToContent(); // skip possible xml declaration
|
reader.MoveToContent(); // skip possible xml declaration
|
||||||
|
|
||||||
|
@ -144,7 +143,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
XmlDocument doc = new XmlDocument();
|
XmlDocument doc = new XmlDocument();
|
||||||
doc.LoadXml(xml);
|
doc.LoadXml(xml);
|
||||||
|
@ -199,9 +197,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
if (data[len - 1] == 0)
|
if (data[len - 1] == 0)
|
||||||
--len;
|
--len;
|
||||||
// Quickly check if this is a coalesced object, without fully parsing the XML
|
// Quickly check if this is a coalesced object, without fully parsing the XML
|
||||||
using (MemoryStream ms = new MemoryStream(data, 0, len, false))
|
MemoryStream ms = new MemoryStream(data, 0, len, false);
|
||||||
{
|
StreamReader sr = new StreamReader(ms, Encoding.UTF8);
|
||||||
using (XmlTextReader reader = new XmlTextReader(ms))
|
using (XmlTextReader reader = new XmlTextReader(sr))
|
||||||
{
|
{
|
||||||
reader.MoveToContent(); // skip possible xml declaration
|
reader.MoveToContent(); // skip possible xml declaration
|
||||||
|
|
||||||
|
@ -211,9 +209,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ms.Seek(0, SeekOrigin.Begin);
|
|
||||||
XmlDocument doc = new XmlDocument();
|
XmlDocument doc = new XmlDocument();
|
||||||
|
using (ms = new MemoryStream(data, 0, len, false))
|
||||||
doc.Load(ms);
|
doc.Load(ms);
|
||||||
|
|
||||||
XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
|
XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
|
||||||
if (e == null)
|
if (e == null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -242,7 +241,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of binary xml failed ", e);
|
m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of binary xml failed ", e);
|
||||||
|
|
|
@ -29,8 +29,8 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
@ -86,7 +86,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
return null;
|
return null;
|
||||||
if(data[len -1 ] == 0)
|
if(data[len -1 ] == 0)
|
||||||
--len;
|
--len;
|
||||||
using (MemoryStream ms = new MemoryStream(data,0, len, false))
|
|
||||||
|
MemoryStream ms = new MemoryStream(data,0, len, false);
|
||||||
|
using(StreamReader sr = new StreamReader(ms, Encoding.UTF8))
|
||||||
{
|
{
|
||||||
using (XmlReader reader = XmlReader.Create(ms, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
|
using (XmlReader reader = XmlReader.Create(ms, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
|
||||||
{
|
{
|
||||||
|
@ -97,7 +99,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[SERIALIZER]: Deserialization of xml data failed ", e);
|
m_log.Error("[SERIALIZER]: Deserialization of xml data failed ", e);
|
||||||
string s = Utils.BytesToString(data);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue