diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2009-04-28 19:55:19 +0400 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2009-04-28 19:55:19 +0400 |
commit | cc6d045346f29af685c90dc4e0226167803524f8 (patch) | |
tree | 7d8553c0234da1ba1fd7d70d3cffbf60f9876440 /mcs/class | |
parent | 42f2df1f80db0a80631827b5bc153682d740a668 (diff) |
In Test/System.Xml:
2009-04-28 Sebastien Pouliot <sebastien@ximian.com>
* XmlReaderCommonTests.cs: Add test case for an empty string url
In System.Xml:
2009-04-28 Sebastien Pouliot <sebastien@ximian.com>
* XmlTextReader.cs (InitializeContext): Under NET_2_1 do not give
a second change using Path.GetFullPath. (GetStreamFromUrl) Add
extra validations that would be missed in NET_2_1
svn path=/trunk/mcs/; revision=132856
Diffstat (limited to 'mcs/class')
4 files changed, 27 insertions, 0 deletions
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog index 6b29611ba50..2c3c9c5bac5 100644 --- a/mcs/class/System.XML/System.Xml/ChangeLog +++ b/mcs/class/System.XML/System.Xml/ChangeLog @@ -1,3 +1,9 @@ +2009-04-28 Sebastien Pouliot <sebastien@ximian.com> + + * XmlTextReader.cs (InitializeContext): Under NET_2_1 do not give + a second change using Path.GetFullPath. (GetStreamFromUrl) Add + extra validations that would be missed in NET_2_1 + 2009-04-28 Sebastien Pouliot <sebastien@ximian.com> * XmlReaderSettings.cs: Add MaxCharactersInDocument property for diff --git a/mcs/class/System.XML/System.Xml/XmlTextReader.cs b/mcs/class/System.XML/System.Xml/XmlTextReader.cs index e2d6211f520..1a1a13e002c 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextReader.cs +++ b/mcs/class/System.XML/System.Xml/XmlTextReader.cs @@ -182,6 +182,12 @@ namespace System.Xml private Stream GetStreamFromUrl (string url, out string absoluteUriString) { +#if NET_2_1 + if (url == null) + throw new ArgumentNullException ("url"); + if (url.Length == 0) + throw new ArgumentException ("url"); +#endif Uri uri = resolver.ResolveUri (null, url); absoluteUriString = uri != null ? uri.ToString () : String.Empty; return resolver.GetEntity (uri, null, typeof (Stream)) as Stream; @@ -1054,6 +1060,9 @@ namespace System.Xml nsmgr = nsmgr != null ? nsmgr : new XmlNamespaceManager (nameTable); if (url != null && url.Length > 0) { +#if NET_2_1 + Uri uri = new Uri (url, UriKind.RelativeOrAbsolute); +#else Uri uri = null; try { #if NET_2_0 @@ -1065,6 +1074,7 @@ namespace System.Xml string path = Path.GetFullPath ("./a"); uri = new Uri (new Uri (path), url); } +#endif parserContext.BaseURI = uri.ToString (); } diff --git a/mcs/class/System.XML/Test/System.Xml/ChangeLog b/mcs/class/System.XML/Test/System.Xml/ChangeLog index 579a5cfb281..71c8242f75e 100644 --- a/mcs/class/System.XML/Test/System.Xml/ChangeLog +++ b/mcs/class/System.XML/Test/System.Xml/ChangeLog @@ -1,3 +1,7 @@ +2009-04-28 Sebastien Pouliot <sebastien@ximian.com> + + * XmlReaderCommonTests.cs: Add test case for an empty string url + 2009-04-28 Sebastien Pouliot <sebastien@ximian.com> * XmlResolverTest.cs: New. Unit tests for base features. diff --git a/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs index f03ea6ae6cc..41f1534873f 100644 --- a/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs +++ b/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs @@ -1576,6 +1576,13 @@ namespace MonoTests.System.Xml }
[Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void Create_String_Empty ()
+ {
+ XmlReader.Create (String.Empty);
+ }
+
+ [Test]
public void ReadToDescendant ()
{
string xml = @"<root><foo/><bar/><foo> test text <bar><bar></bar></bar></foo></root>";
|