Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2005-12-26 17:33:20 +0300
committerAtsushi Eno <atsushieno@gmail.com>2005-12-26 17:33:20 +0300
commitd120a4fc6e3ca5c8b202173e1a34d77d3d12b3de (patch)
tree28fd0e3f6187081d4abed0ab802f01e912323e85 /mcs/class/System.XML
parentbf5bf0e19ff1dbb8be770f3827ac897e93407f5d (diff)
2005-12-26 Atsushi Enomoto <atsushi@ximian.com>
* XmlElement.cs : patch for Prefix property by Vorobiev Maksim. - null should cause ArgumentNullException. - "" should not raise an error. - throws ArgumentException when it is readonly. * XmlElementTests.cs : Patch by Vorobiev Maksim. - setting null to Prefix should raise ArgumentNullException. - setting String.Empty to Prefix should be allowed. svn path=/trunk/mcs/; revision=54849
Diffstat (limited to 'mcs/class/System.XML')
-rw-r--r--mcs/class/System.XML/System.Xml/ChangeLog7
-rw-r--r--mcs/class/System.XML/System.Xml/XmlElement.cs6
-rw-r--r--mcs/class/System.XML/Test/System.Xml/ChangeLog6
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs17
4 files changed, 34 insertions, 2 deletions
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog
index 0edca49b732..60c36089104 100644
--- a/mcs/class/System.XML/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/System.Xml/ChangeLog
@@ -1,3 +1,10 @@
+2005-12-26 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlElement.cs : patch for Prefix property by Vorobiev Maksim.
+ - null should cause ArgumentNullException.
+ - "" should not raise an error.
+ - throws ArgumentException when it is readonly.
+
2005-12-23 Atsushi Enomoto <atsushi@ximian.com>
* XmlTextWriter.cs : When xml:space or xml:lang attribute was
diff --git a/mcs/class/System.XML/System.Xml/XmlElement.cs b/mcs/class/System.XML/System.Xml/XmlElement.cs
index 1ba651f6185..b008b0c0ff1 100644
--- a/mcs/class/System.XML/System.Xml/XmlElement.cs
+++ b/mcs/class/System.XML/System.Xml/XmlElement.cs
@@ -215,8 +215,10 @@ namespace System.Xml
get { return name.Prefix; }
set {
if (IsReadOnly)
- throw new XmlException ("This node is readonly.");
- if (!XmlChar.IsNCName (value))
+ throw new ArgumentException ("This node is readonly.");
+ if (value == null)
+ throw new ArgumentNullException("Prefix value is null.");
+ if ((!String.Empty.Equals(value))&&(!XmlChar.IsNCName (value)))
throw new ArgumentException ("Specified name is not a valid NCName: " + value);
value = OwnerDocument.NameTable.Add (value);
diff --git a/mcs/class/System.XML/Test/System.Xml/ChangeLog b/mcs/class/System.XML/Test/System.Xml/ChangeLog
index 78e50b7b722..bed9f0ed172 100644
--- a/mcs/class/System.XML/Test/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/Test/System.Xml/ChangeLog
@@ -1,5 +1,11 @@
2005-12-26 Atsushi Enomoto <atsushi@ximian.com>
+ * XmlElementTests.cs : Patch by Vorobiev Maksim.
+ - setting null to Prefix should raise ArgumentNullException.
+ - setting String.Empty to Prefix should be allowed.
+
+2005-12-26 Atsushi Enomoto <atsushi@ximian.com>
+
* XsdValidatingReaderTests.cs : test for multi URLs in
schemaLocation. Test by Vorobiev Maskim.
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs
index 07ef8032e12..89af454522c 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs
@@ -559,5 +559,22 @@ namespace MonoTests.System.Xml
document.DocumentElement.WriteTo (xtw);
AssertEquals ("<root>&foo;</root>", sw.ToString ());
}
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void SetNullPrefix ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<root/>");
+ doc.DocumentElement.Prefix = null;
+ }
+
+ [Test]
+ public void SetEmptyStringPrefix ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<root/>");
+ doc.DocumentElement.Prefix = String.Empty;
+ }
}
}