[Mono-bugs] [Bug 347768] New: XmlReader. ReadToNextSibling hangs when no next sibling exists
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue Dec 11 15:02:22 EST 2007
https://bugzilla.novell.com/show_bug.cgi?id=347768
Summary: XmlReader.ReadToNextSibling hangs when no next sibling
exists
Product: Mono: Runtime
Version: 1.2.6
Platform: i386
OS/Version: RHEL 5
Status: NEW
Severity: Critical
Priority: P5 - None
Component: misc
AssignedTo: mono-bugs at ximian.com
ReportedBy: srfcanada at hotmail.com
QAContact: mono-bugs at ximian.com
Found By: ---
Xml reader method hangs when reading xml file.
when it gets to reader.ReadToNextSibling("SystemsOfUnits"); it will hang at
that point. I also attached the xml file it was reading.
/// <summary>
/// Initialises the manager from a xml configuration file defining the
quantities and units. It
/// generates the instances of the corresponding classes and add them to
the lists of quantities
/// and units.
/// </summary>
/// <param name="fileName">The name of the xml file</param>
public void InitialiseFromXmlConfigFile(string fileName)
{
// Creates the Xml reader giving the file name
System.Console.WriteLine("A1");
XmlReader reader = XmlReader.Create(fileName);
System.Console.WriteLine("A2");
// The first element is the root node and should be called
DRMSQuantitiesAndUnits
reader.MoveToContent();
System.Console.WriteLine("A3");
if (!(reader.NodeType == XmlNodeType.Element && reader.Name ==
"DRMSQuantitiesAndUnits"))
{
throw new Exception("Root node should be
'DRMSQuantitiesAndUnits'");
}
System.Console.WriteLine("A4");
// This is the loop over the base quantities
bool stillReadingQuantities = true;
System.Console.WriteLine("A6");
while (stillReadingQuantities)
{
System.Console.WriteLine("A7");
if (!reader.Read())
{
throw new Exception("Unexpected end of file before reading base
quantities list");
}
// Process the list of base quantities
if (reader.NodeType == XmlNodeType.Element)
{
if (reader.Name != "BaseQuantities")
{
{
throw new Exception("The list of base quantities is
missing");
}
}
// Loop over all base quantities
m_numberOfBaseQuantities = 0;
while (stillReadingQuantities)
{
if (reader.NodeType == XmlNodeType.Element && reader.Name ==
"Quantity")
{
readBaseQuantity(reader);
reader.ReadToNextSibling("Quantity");
reader.ReadToNextSibling("Quantity");
}
else if (reader.NodeType == XmlNodeType.EndElement &&
reader.Name == "BaseQuantities")
{
stillReadingQuantities = false;
}
else
{
if (!reader.Read())
{
throw new Exception("Unexpected end of file in the
middle of base quantities list");
}
}
}
}
}
System.Console.WriteLine("A8");
// This is the loop over the derived quantities
stillReadingQuantities = true;
System.Console.WriteLine("A9");
while (stillReadingQuantities)
{
System.Console.WriteLine("A9a");
// Process the list of derived quantities
reader.ReadToNextSibling("DerivedQuantities");
System.Console.WriteLine("A9b");
if (reader.NodeType == XmlNodeType.Element)
{
if (reader.Name != "DerivedQuantities")
{
{
throw new Exception("The list of derived quantities is
missing");
}
}
// Loop over all derived quantities
stillReadingQuantities = true;
m_numberOfDerivedQuantities = 0;
while (stillReadingQuantities)
{
if (reader.NodeType == XmlNodeType.Element && reader.Name ==
"Quantity")
{
readDerivedQuantity(reader);
reader.ReadToNextSibling("Quantity");
if (reader.NodeType == XmlNodeType.EndElement &&
reader.Name == "DerivedQuantities")
{
stillReadingQuantities = false;
}
else
{
reader.ReadToNextSibling("Quantity");
}
}
else
{
if (!reader.Read())
{
throw new Exception("Unexpected end of file in the
middle of base quantities list");
}
}
}
}
}
System.Console.WriteLine("A10");
// This is the loop over the systems of units
while (reader.Read())
{
System.Console.WriteLine("A10a"+reader.Name);
// Process the list of systems of units
reader.ReadToNextSibling("SystemsOfUnits");
System.Console.WriteLine("A10aaaaaa");
if (reader.NodeType == XmlNodeType.Element)
{
if (reader.Name != "SystemsOfUnits")
{
{
throw new Exception("The list of systems of units is
missing");
}
}
// Loop over all systems of units
bool stillReadingSystemsOfUnits = true;
while (stillReadingSystemsOfUnits)
{
System.Console.WriteLine("A10111"+reader.Name);
if (reader.NodeType == XmlNodeType.Element && reader.Name ==
"SystemOfUnits")
{
readSystemOfUnits(reader);
reader.ReadToNextSibling("SystemOfUnits");
reader.ReadToNextSibling("SystemOfUnits");
}
else if ((reader.NodeType == XmlNodeType.EndElement &&
reader.Name == "SystemsOfUnits") ||
(reader.NodeType == XmlNodeType.EndElement &&
reader.Name == "DRMSQuantitiesAndUnits"))
{
stillReadingSystemsOfUnits = false;
}
else
{
if (!reader.Read())
{
System.Console.WriteLine("A10Faile");
throw new Exception("Unexpected end of file in the
middle of base quantities list");
}
}
}
}
}
System.Console.WriteLine("A11");
m_isInitialized = true;
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list