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:
authorSebastien Pouliot <sebastien@ximian.com>2004-06-06 03:50:40 +0400
committerSebastien Pouliot <sebastien@ximian.com>2004-06-06 03:50:40 +0400
commita8971188804356e5a160967a656fad31c88c4eb3 (patch)
treefa6b50f653ea72b1feefcbb264deed49632fc772 /mcs/class/System/System.Collections.Specialized
parentd497ff12cde5cee103ddd3a67bdefcb4e36e7538 (diff)
2004-06-05 Sebastien Pouliot <sebastien@ximian.com>
* HybridDictionary.cs: Fixed Contains for null argument. * NameValueCollection.cs: Fixed Set to remove existing values. Fixed Add(NVC) to throw same exception as MS implementation. svn path=/trunk/mcs/; revision=28891
Diffstat (limited to 'mcs/class/System/System.Collections.Specialized')
-rwxr-xr-xmcs/class/System/System.Collections.Specialized/ChangeLog6
-rw-r--r--mcs/class/System/System.Collections.Specialized/HybridDictionary.cs8
-rw-r--r--mcs/class/System/System.Collections.Specialized/NameValueCollection.cs31
3 files changed, 30 insertions, 15 deletions
diff --git a/mcs/class/System/System.Collections.Specialized/ChangeLog b/mcs/class/System/System.Collections.Specialized/ChangeLog
index d9d237937fe..b24b7354e59 100755
--- a/mcs/class/System/System.Collections.Specialized/ChangeLog
+++ b/mcs/class/System/System.Collections.Specialized/ChangeLog
@@ -1,3 +1,9 @@
+2004-06-05 Sebastien Pouliot <sebastien@ximian.com>
+
+ * HybridDictionary.cs: Fixed Contains for null argument.
+ * NameValueCollection.cs: Fixed Set to remove existing values. Fixed
+ Add(NVC) to throw same exception as MS implementation.
+
2004-05-24 Lluis Sanchez Gual <lluis@ximian.com>
* StringCollection.cs: Renamed internal variable to make serialization
diff --git a/mcs/class/System/System.Collections.Specialized/HybridDictionary.cs b/mcs/class/System/System.Collections.Specialized/HybridDictionary.cs
index 44548f38774..859a052f511 100644
--- a/mcs/class/System/System.Collections.Specialized/HybridDictionary.cs
+++ b/mcs/class/System/System.Collections.Specialized/HybridDictionary.cs
@@ -2,7 +2,9 @@
// System.Collections.Specialized.HybridDictionary.cs
//
// Author:
-// Lawrence Pit (loz@cable.a2000.nl)
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+// Copyright (C) 2004 Novell (http://www.novell.com)
//
using System;
@@ -133,7 +135,9 @@ namespace System.Collections.Specialized {
}
public bool Contains (object key)
- {
+ {
+ if (key == null)
+ return false;
if (list != null)
return list.Contains (key);
return hashtable.Contains (key);
diff --git a/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs b/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs
index b56c54486ab..1cc52223360 100644
--- a/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs
+++ b/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs
@@ -49,7 +49,7 @@ namespace System.Collections.Specialized{
public NameValueCollection( NameValueCollection col ) : base(col.HashCodeProvider,col.Comparer)
{
if (col==null)
- throw new ArgumentNullException("Null argument is not allowed");
+ throw new ArgumentNullException ("col");
Add(col);
}
@@ -145,7 +145,9 @@ namespace System.Collections.Specialized{
if (this.IsReadOnly)
throw new NotSupportedException ("Collection is read-only");
if (c == null)
- throw new ArgumentNullException ();
+ throw new NullReferenceException ("c");
+// make sense - but it's not the exception thrown
+// throw new ArgumentNullException ();
InvalidateCachedArrays ();
int max = c.Count;
@@ -161,11 +163,8 @@ namespace System.Collections.Specialized{
/// <summary> SDK: Adds an entry with the specified name and value to the
/// NameValueCollection. </summary>
///
- /// LAMESPEC:
/// in SDK doc: If the same value already exists under the same key in the collection,
- /// the new value overwrites the old value.
- /// however the Microsoft implemenatation in this case just adds one more value
- /// in other words after
+ /// it just adds one more value in other words after
/// <code>
/// NameValueCollection nvc;
/// nvc.Add("LAZY","BASTARD")
@@ -338,16 +337,22 @@ namespace System.Collections.Specialized{
/// <summary>
/// Sets the value of an entry in the NameValueCollection.
/// </summary>
- public virtual void Set( string name, string value )
+ public virtual void Set (string name, string value)
{
if (this.IsReadOnly)
- throw new NotSupportedException("Collection is read-only");
- InvalidateCachedArrays();
-
- ArrayList values = new ArrayList();
- values.Add(value);
- BaseSet(name,values);
+ throw new NotSupportedException ("Collection is read-only");
+ InvalidateCachedArrays ();
+
+ ArrayList values = new ArrayList ();
+ if (value != null) {
+ values.Add (value);
+ BaseSet (name,values);
+ }
+ else {
+ // remove all entries
+ BaseSet (name, null);
+ }
}