diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2004-06-14 23:12:47 +0400 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2004-06-14 23:12:47 +0400 |
commit | 95d1497d5fb92d6ea7c1ec206a94db08eddc71ed (patch) | |
tree | 6a7c9701cb856e1dfee41e6143622ca7475cffab /mcs/class/System/System.Collections.Specialized | |
parent | 4c43e39933f0bb008f88f5a2522a7d28160d84b9 (diff) |
2004-06-14 Sebastien Pouliot <sebastien@ximian.com>
* HybridDictionary.cs: Fixed Contains for null argument (again). Return
false when dictionary is empty or else throw an ArgumentNullException.
* NameValueCollection.cs: Added missing Rank check in CopyTo (Array,
int).
svn path=/trunk/mcs/; revision=29534
Diffstat (limited to 'mcs/class/System/System.Collections.Specialized')
3 files changed, 16 insertions, 2 deletions
diff --git a/mcs/class/System/System.Collections.Specialized/ChangeLog b/mcs/class/System/System.Collections.Specialized/ChangeLog index b24b7354e59..7366e00ad39 100755 --- a/mcs/class/System/System.Collections.Specialized/ChangeLog +++ b/mcs/class/System/System.Collections.Specialized/ChangeLog @@ -1,3 +1,10 @@ +2004-06-14 Sebastien Pouliot <sebastien@ximian.com> + + * HybridDictionary.cs: Fixed Contains for null argument (again). Return + false when dictionary is empty or else throw an ArgumentNullException. + * NameValueCollection.cs: Added missing Rank check in CopyTo (Array, + int). + 2004-06-05 Sebastien Pouliot <sebastien@ximian.com> * HybridDictionary.cs: Fixed Contains for null argument. diff --git a/mcs/class/System/System.Collections.Specialized/HybridDictionary.cs b/mcs/class/System/System.Collections.Specialized/HybridDictionary.cs index 859a052f511..988a6c65795 100644 --- a/mcs/class/System/System.Collections.Specialized/HybridDictionary.cs +++ b/mcs/class/System/System.Collections.Specialized/HybridDictionary.cs @@ -136,8 +136,12 @@ namespace System.Collections.Specialized { public bool Contains (object key)
{ - if (key == null) - return false;
+ if (key == null) { + if (this.Count == 0) + return false; + else + throw new ArgumentNullException ("key");
+ } 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 1cc52223360..7de9f81256b 100644 --- a/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs +++ b/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs @@ -5,6 +5,7 @@ // Gleb Novodran // // (C) Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004 Novell (http://www.novell.com) // using System; @@ -212,6 +213,8 @@ namespace System.Collections.Specialized{ throw new ArgumentNullException("dest", "Null argument - dest"); if (index<0) throw new ArgumentOutOfRangeException("index", "index is less than 0"); + if (dest.Rank > 1) + throw new ArgumentException ("dest", "multidim"); if (cachedAll==null) RefreshCachedAll(); |