2007-06-21 Nagappan A <anagappan@novell.com>
authorNagappan Alagappan <nagappan@gmail.com>
Thu, 21 Jun 2007 13:09:49 +0000 (13:09 -0000)
committerNagappan Alagappan <nagappan@gmail.com>
Thu, 21 Jun 2007 13:09:49 +0000 (13:09 -0000)
* DbConnectionStringBuilder.cs (Init): Modified the dictionary to
use StringComparer.InvariantCultureIgnoreCase.
(Add, ContainsKey): Checks whether argument is null or empty string.

svn path=/trunk/mcs/; revision=80465

mcs/class/System.Data/System.Data.Common/ChangeLog
mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs

index 8551a0c10226394745efc0ba92e3a3ee7539bc91..d7a55f33d783706c301b03bb43ac74ce1b8daeab 100644 (file)
@@ -1,3 +1,9 @@
+2007-06-21  Nagappan A  <anagappan@novell.com>
+
+       * DbConnectionStringBuilder.cs (Init): Modified the dictionary to
+       use StringComparer.InvariantCultureIgnoreCase.
+       (Add, ContainsKey): Checks whether argument is null or empty string.
+
 2007-05-08  Adar Wesley <adarw@mainsoft.com>
 
        * DbProviderFactory.cs: minor refactoring for throwing exceptions
index a6b7332b708a4741374b169e4b79482e58e9f819..b9e7dd8733193bbfd3ce98b311d4b64f75e92f82 100644 (file)
@@ -59,7 +59,7 @@ namespace System.Data.Common
 
                 private void Init ()
                 {
-                        _dictionary = new Dictionary<string, object> ();
+                        _dictionary = new Dictionary <string, object> (StringComparer.InvariantCultureIgnoreCase);
                 }
 
                 #endregion // Constructors
@@ -130,7 +130,7 @@ namespace System.Data.Common
                                 if (ContainsKey (keyword))
                                         return _dictionary [keyword];
                                 else
-                                        throw new ArgumentException ();
+                                        throw new ArgumentException ("Keyword does not exist");
                         }
                         set { Add (keyword, value); }
                 }
@@ -171,6 +171,10 @@ namespace System.Data.Common
 
                 public void Add (string keyword, object value)
                 {
+                       if (keyword == null || keyword.Trim () == "")
+                               throw new ArgumentException ("Keyword should not be emtpy");
+                       if (value == null)
+                               throw new ArgumentException ("Keyword not supported", keyword);
                         if (ContainsKey (keyword)) {
                                 _dictionary [keyword] = value;
                         } else {
@@ -209,6 +213,8 @@ namespace System.Data.Common
 
                 public virtual bool ContainsKey (string keyword)
                 {
+                       if (keyword == null)
+                               throw new ArgumentNullException ("Invalid argument", keyword);
                         return _dictionary.ContainsKey (keyword);
                 }