[Mono-bugs] [Bug 56510][Blo] Changed - XmlDataDocument loading stream bug

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 6 Apr 2004 20:28:55 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by yom@iaelu.net.

http://bugzilla.ximian.com/show_bug.cgi?id=56510

--- shadow/56510	2004-04-06 20:26:38.000000000 -0400
+++ shadow/56510.tmp.21157	2004-04-06 20:28:55.000000000 -0400
@@ -1,11 +1,11 @@
 Bug#: 56510
 Product: Mono: Class Libraries
 Version: unspecified
 OS: GNU/Linux [Other]
-OS Details: 
+OS Details: Crux 1.3 / kernel 2.6.5
 Status: NEW   
 Resolution: 
 Severity: Unknown
 Priority: Blocker
 Component: Sys.XML
 AssignedTo: mono-bugs@ximian.com                            
@@ -270,6 +270,156 @@
 
 ##### XmlDataDocument:Load #####
 
 i've been changing this localy on the 0.31 release inside
 mcs/class/System.Data/System.Xml and after some test, it's working now
 for both the XmlTextReader and Stream object.
+
+------- Additional Comments From yom@iaelu.net  2004-04-06 20:28 -------
+Description of Problem:
+Some problems occure when i try to load a xml file from a stream. For now,
+the main test on which i could get this error was when i was trying to
+load
+a stream to a XmlDataDocument, using a HttpResponse stream.
+But after a simple bug test with just a StreamReader and a XmlDataDocument
+i could get the same error.
+
+
+Steps to reproduce the problem:
+here is a code sample which would normally bug
+test.xml is a simple xml file, you can take whatever xml file you want or
+create one. my xml file contains data i'm using for another
+application but
+using another method to load it.
+
+###### CODE FROM HERE ######
+
+using System;
+using System.IO;
+using System.Data;
+using System.Xml;
+
+class MainClass
+{
+	public static void Main(string[] args)
+	{
+		StreamReader sr = new StreamReader("test.xml");
+		XmlDataDocument xdd = new XmlDataDocument();
+		
+		xdd.Load(sr);
+	}
+}
+
+###### CODE ENDS HERE ######
+
+Actual Results:
+result is clearly a crash from the little console application :
+
+###### RESULT FROM HERE ######
+
+$ mono StreamXmlBug.exe
+ 
+Unhandled Exception: System.ArgumentException: The path is not of a
+legal form
+Parameter name: path
+in <0x000ab> System.IO.Path:GetFullPath (string)
+in <0x000f0> System.Xml.XmlResolver:ResolveUri (System.Uri,string)
+in <0x000f8> System.Xml.XmlTextReader:.ctor
+(string,System.Xml.XmlNameTable)
+in <0x00037> System.Xml.XmlTextReader:.ctor (string)
+in <0x0010a> System.Xml.XmlDataDocument:Load (System.Xml.XmlReader)
+in <0x0003b> System.Xml.XmlDataDocument:Load (System.IO.TextReader)
+in <0x0005c> MainClass:Main (string[])
+
+###### RESULT ENDS HERE ######
+
+Expected Results:
+Expected result is that the xml file should be loaded into the
+XmlDataDocument object.
+
+
+How often does this happen? 
+For now, this is happening all the time, even if i try to open the
+StreamReader using the correct encoding, let's say utf-8.
+
+
+Additional Information:
+Loading a xml file from a XmlTextReader object with a XmlDataDocument
+object is working perfectly and it is working all the time, with the exact
+same xml file
+Here is a sample code :
+
+###### SAMPLE CODE FROM HERE ######
+
+using System;
+using System.Data;
+using System.IO;
+using System.Xml;
+
+class MainClass
+{
+	public static void Main(string[] args)
+	{
+		XmlTextReader xtr = new XmlTextReader("test.xml");
+		XmlDataDocument xdd = new XmlDataDocument();
+		
+		xdd.Load(xtr);
+	}
+}
+
+###### SAMPLE CODE ENDS HERE ######
+
+If you are looking for a quick xml file, here is also a sample :
+
+###### XML FILE FROM HERE ######
+
+<?xml version="1.0" encoding="utf-8"?>
+<server>
+  <conf>/opt/apache2/conf/httpd.conf</conf>
+  <status>1</status>
+  <sites>
+    <site name="Site">
+      <alias>alias</alias>
+      <path>path</path>
+      <status>1</status>
+    </site>
+  </sites>
+</server>
+
+###### XML FILE ENDS HERE ######
+
+
+* * * Additional Comments * * *
+
+
+Just changed the priority because it's blocking if someone has got to
+developp an application which get a stream(file) from a server with a
+cookie based authentication, or even for a credential authentication.
+
+For now, i've been looking the code and tried a few things on the
+XmlDataDocument source code.
+Basically, you cannot call in the XmlDataDocument:Load method a
+XmlTextReader just to get a copy in memory, this is a waste of time
+for the case the developper is already using a XmlTextReader in his
+application to load his XmlDataDocument.. just imagine that you are
+loading 2 times data for an operation that requires only once the data.
+
+so...
+##### XmlDataDocument:Load #####
+...
+XmlTextReader textReader = new XmlTextReader(reader.BaseUri);
+...
+##### XmlDataDocument:Load #####
+
+No way.. just comment that thing. And instead of that, you can move up
+the base.Load(textReader) and change it to this :
+
+##### XmlDataDocument:Load #####
+
+//XmlTextReader textReader = new XmlTextReader(reader.BaseUri);
+base.Load(reader);
+
+##### XmlDataDocument:Load #####
+
+i've been changing this localy on the 0.31 release inside
+mcs/class/System.Data/System.Xml and after some test, it's working now
+for both the XmlTextReader and Stream object.