Author: atsushi
Date: 2008-01-24 22:47:12 -0500 (Thu, 24 Jan 2008)
New Revision: 93873

Modified:
   trunk/mcs/class/System.XML/System.Xml/ChangeLog
   trunk/mcs/class/System.XML/System.Xml/XmlReader.cs
   trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog
   trunk/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
Log:
2008-01-25  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * XmlReader.cs : MoveToNextSibling() should check EOF (as Skip() does
          not). Fixed bug #347768.

        * XmlReaderCommonTests.cs : added test for bug #347768.



Modified: trunk/mcs/class/System.XML/System.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/ChangeLog     2008-01-25 01:37:47 UTC 
(rev 93872)
+++ trunk/mcs/class/System.XML/System.Xml/ChangeLog     2008-01-25 03:47:12 UTC 
(rev 93873)
@@ -1,3 +1,8 @@
+2008-01-25  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * XmlReader.cs : MoveToNextSibling() should check EOF (as Skip() does
+         not). Fixed bug #347768.
+
 2008-01-15  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * XmlParserContext.cs : do not pass invalid URI to XmlTextReader#ctor

Modified: trunk/mcs/class/System.XML/System.Xml/XmlReader.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/XmlReader.cs  2008-01-25 01:37:47 UTC 
(rev 93872)
+++ trunk/mcs/class/System.XML/System.Xml/XmlReader.cs  2008-01-25 03:47:12 UTC 
(rev 93873)
@@ -848,7 +848,8 @@
                        if (ReadState != ReadState.Interactive)
                                return false;
                        int depth = Depth;
-                       for (Skip (); depth <= Depth; Skip ())
+                       Skip ();
+                       for (; !EOF && depth <= Depth; Skip ())
                                if (NodeType == XmlNodeType.Element && name == 
Name)
                                        return true;
                        return false;
@@ -859,7 +860,8 @@
                        if (ReadState != ReadState.Interactive)
                                return false;
                        int depth = Depth;
-                       for (Skip (); depth <= Depth; Skip ())
+                       Skip ();
+                       for (; !EOF && depth <= Depth; Skip ())
                                if (NodeType == XmlNodeType.Element && 
localName == LocalName && namespaceURI == NamespaceURI)
                                        return true;
                        return false;

Modified: trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog        2008-01-25 
01:37:47 UTC (rev 93872)
+++ trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog        2008-01-25 
03:47:12 UTC (rev 93873)
@@ -1,3 +1,7 @@
+2008-01-25  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * XmlReaderCommonTests.cs : added test for bug #347768.
+
 2008-01-15  Gert Driesen  <[EMAIL PROTECTED]>
 
        * XmlParserContextTests.cs: Added ctor tests.

Modified: trunk/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs  
2008-01-25 01:37:47 UTC (rev 93872)
+++ trunk/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs  
2008-01-25 03:47:12 UTC (rev 93873)
@@ -1682,7 +1682,20 @@
                        AssertEquals ("#5", "foo", r.LocalName);
                }
 
+               // bug #347768
                [Test]
+               public void ReadToNextSibling3 ()
+               {
+                       string xml = @" <books> <book> <name>Happy C 
Sharp</name> </book> </books>";
+                       XmlReader reader = XmlReader.Create (new StringReader 
(xml));
+
+                       reader.MoveToContent ();
+
+                       while (reader.Read ())
+                               reader.ReadToNextSibling ("book"); // should 
not result in an infinite loop
+               }
+
+               [Test]
                public void ReadSubtree ()
                {
                        string xml = @"<root><foo/><bar 
attr='value'></bar></root>";

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to