2005-01-14 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Fri, 14 Jan 2005 17:03:07 +0000 (17:03 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Fri, 14 Jan 2005 17:03:07 +0000 (17:03 -0000)
* DbDataPermissionAttribute.cs, PermissionHelper.cs :
  fixed some incompatible type of exception between 2.0 and 1.x.
* DataContainer.cs :
  Wrap exceptions thrown by SetValue() within ArgumentException.

* SqlClientPermissionTest.cs, SqlClientPermissionAttributeTest.cs:
  Fixed some incompatible type of exception between 2.0 and 1.1.

* OleDbPermissionTest.cs, OleDbPermissionAttributeTest.cs:
  Fixed some incompatible type of exception between 2.0 and 1.1.

* OdbcPermissionTest.cs, OdbcPermissionAttributeTest.cs:
  Fixed some incompatible type of exception between 2.0 and 1.1.

* DBDataPermissionTest.cs, DBDataPermissionAttributeTest.cs:
  Fixed some incompatible type of exception between 2.0 and 1.1.

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

16 files changed:
mcs/class/System.Data/System.Data.Common/ChangeLog
mcs/class/System.Data/System.Data.Common/DataContainer.cs
mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs
mcs/class/System.Data/System.Data.Common/PermissionHelper.cs
mcs/class/System.Data/Test/System.Data.Common/ChangeLog
mcs/class/System.Data/Test/System.Data.Common/DBDataPermissionAttributeTest.cs
mcs/class/System.Data/Test/System.Data.Common/DBDataPermissionTest.cs
mcs/class/System.Data/Test/System.Data.Odbc/ChangeLog
mcs/class/System.Data/Test/System.Data.Odbc/OdbcPermissionAttributeTest.cs
mcs/class/System.Data/Test/System.Data.Odbc/OdbcPermissionTest.cs
mcs/class/System.Data/Test/System.Data.OleDb/ChangeLog
mcs/class/System.Data/Test/System.Data.OleDb/OleDbPermissionAttributeTest.cs
mcs/class/System.Data/Test/System.Data.OleDb/OleDbPermissionTest.cs
mcs/class/System.Data/Test/System.Data.SqlClient/ChangeLog
mcs/class/System.Data/Test/System.Data.SqlClient/SqlClientPermissionAttributeTest.cs
mcs/class/System.Data/Test/System.Data.SqlClient/SqlClientPermissionTest.cs

index 22b4392b1a14117e268ccf34f70a41620776886a..0e5c65d38a351e38f2bf25eb41292690d11b2159 100755 (executable)
@@ -1,3 +1,10 @@
+2005-01-14  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DbDataPermissionAttribute.cs, PermissionHelper.cs :
+         fixed some incompatible type of exception between 2.0 and 1.x.
+       * DataContainer.cs :
+         Wrap exceptions thrown by SetValue() within ArgumentException.
+
 2004-12-10  Sureshkumar T  <tsureshkumar@novell.com>
 
        * DbDataAdapter.cs (BuildSchema): Add the primary key schema iff
index ce73ea784916d073581277dc7e74c6673ae1fa5d..42c74108b0cb38216523d2f4b7803705e3c112c2 100644 (file)
@@ -218,7 +218,11 @@ namespace System.Data.Common
                                                SetValue(index,(short)value);
                                        }
                                        else {
-                                               SetValue(index,Convert.ToInt16(value));
+                                               try {
+                                                       SetValue(index,Convert.ToInt16(value));
+                                               } catch (Exception ex) {
+                                                       throw new ArgumentException (ex.Message, ex);
+                                               }
                                        }
                                        SetNull(index,value == null,isDbNull);
                                }
index ad717d1955fc317d2fbdb96bf9de4c17c6118129..5c43eb69c61a299eb2ba0409dfcd7486636a81ac 100644 (file)
@@ -91,7 +91,11 @@ namespace System.Data.Common {
                        set {
                                if (!Enum.IsDefined (typeof (KeyRestrictionBehavior), value)) {
                                        string msg = Locale.GetText ("Unknown value.");
+#if NET_2_0
                                        throw new ArgumentOutOfRangeException ("KeyRestrictionBehavior", value, msg);
+#else
+                                       throw new ArgumentException ("KeyRestrictionBehavior", msg);
+#endif
                                }
                                keyRestrictionBehavior = value;
                        }
index e2e5c08b838eb6b92b5ca02a138175864717176e..864a1edc336a6d7c497b3bfde36ced5ae7cffad1 100644 (file)
@@ -59,7 +59,11 @@ namespace System.Data.Common {
                                break;
                        default:
                                msg = String.Format (Locale.GetText ("Invalid enum {0}"), state);
+#if NET_2_0
                                throw new ArgumentOutOfRangeException (msg, "state");
+#else
+                               throw new ArgumentException (msg, "state");
+#endif
                        }
                        return state;
                }
index 30cc6b5dc8726368474e5bcd106351a50aa82c84..b5eaab7dca70165bc75dcf828bb0439a02557ae3 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-14  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DBDataPermissionTest.cs, DBDataPermissionAttributeTest.cs:
+         Fixed some incompatible type of exception between 2.0 and 1.1.
+
 2005-01-14  Atsushi Enomoto  <atsushi@ximian.com>
 
        * DataTableMappingCollectionTest.cs,
index 1a368260fa0e1ebebabb9ea51bc6c4ee225694a6..29b4f389fe060bc9ac76cb633c5dc6581a2c5cea 100755 (executable)
@@ -140,7 +140,11 @@ namespace MonoTests.System.Data.Common {
                }\r
 \r
                [Test]\r
+#if NET_2_0\r
                [ExpectedException (typeof (ArgumentOutOfRangeException))]\r
+#else\r
+               [ExpectedException (typeof (ArgumentException))]\r
+#endif\r
                public void KeyRestrictionBehavior_Invalid ()\r
                {\r
                        DBDataPermissionAttribute a = new NonAbstractDBDataPermissionAttribute (SecurityAction.Assert);\r
index 1abb13cd08c29894657939096833db2e437dae36..32b5d55e66bd1049c38b00dc15cda2ed0f23680a 100644 (file)
@@ -210,7 +210,11 @@ namespace MonoTests.System.Data.Common {
                }
 #endif
                [Test]
+#if NET_2_0
                [ExpectedException (typeof (ArgumentOutOfRangeException))]
+#else
+               [ExpectedException (typeof (ArgumentException))]
+#endif
                public void Constructor_PermissionState_Invalid ()
                {
                        PermissionState ps = (PermissionState) Int32.MinValue;
@@ -571,7 +575,7 @@ namespace MonoTests.System.Data.Common {
                {
                        NonAbstractDBDataPermission empty = new NonAbstractDBDataPermission (PermissionState.None);
                        NonAbstractDBDataPermission union = (NonAbstractDBDataPermission) empty.Union (empty);
-                       Assert.IsNull (union, "Empty U Empty");
+                       Assert.IsNotNull (union, "Empty U Empty");
 
                        NonAbstractDBDataPermission dbdp1 = new NonAbstractDBDataPermission (PermissionState.None);
                        dbdp1.Add (defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
index c1b17ab845ba247cf22a395ff62b382ed2fe05a4..6c4ecebe3dfa205735651d2d43feee3190227311 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-14  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * OdbcPermissionTest.cs, OdbcPermissionAttributeTest.cs:
+         Fixed some incompatible type of exception between 2.0 and 1.1.
+
 2004-11-26  Sureshkumar T  <tsureshkumar@novell.com>
 
        * OdbcParameterCollectionTest.cs: New file for testing
index 9f5f10eed7987973f284eaa8ccab58dd7cf01abd..082c0ea48b4d075cc7122397e2c5973a66902c83 100755 (executable)
@@ -146,7 +146,11 @@ namespace MonoTests.System.Data.Odbc {
                }\r
 \r
                [Test]\r
+#if NET_2_0\r
                [ExpectedException (typeof (ArgumentOutOfRangeException))]\r
+#else\r
+               [ExpectedException (typeof (ArgumentException))]\r
+#endif\r
                public void KeyRestrictionBehavior_Invalid ()\r
                {\r
                        OdbcPermissionAttribute a = new OdbcPermissionAttribute (SecurityAction.Assert);\r
index 1d61060f1faf777eb4f392ebffd03aae2a9211a8..37f0e426edaedae15de2f4c9eb5f7e2065f3aba9 100644 (file)
@@ -52,7 +52,11 @@ namespace MonoTests.System.Data.Odbc {
                }
 
                [Test]
+#if NET_2_0
                [ExpectedException (typeof (ArgumentOutOfRangeException))]
+#else
+               [ExpectedException (typeof (ArgumentException))]
+#endif
                public void PermissionState_Invalid ()
                {
                        PermissionState ps = (PermissionState)Int32.MinValue;
index 032ed23ee5984bab6a50b910dfc5598a09f8c160..045028e23f398a8281a257de115fc4c15d897ea5 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-14  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * OleDbPermissionTest.cs, OleDbPermissionAttributeTest.cs:
+         Fixed some incompatible type of exception between 2.0 and 1.1.
+
 2004-09-15  Sebastien Pouliot  <sebastien@ximian.com>
 
        * OleDbPermissionTest.cs: New. Unit tests for OleDbPermission.
index 659a0abd795110fccae6752f412340e2336054e9..f645b6212cf1ac78d62b7da289d58a11a975c984 100755 (executable)
@@ -147,7 +147,11 @@ namespace MonoTests.System.Data.OleDb {
                }\r
 \r
                [Test]\r
+#if NET_2_0\r
                [ExpectedException (typeof (ArgumentOutOfRangeException))]\r
+#else\r
+               [ExpectedException (typeof (ArgumentException))]\r
+#endif\r
                public void KeyRestrictionBehavior_Invalid ()\r
                {\r
                        OleDbPermissionAttribute a = new OleDbPermissionAttribute (SecurityAction.Assert);\r
index 01cd61065292202baa0d9750d115f335006785d2..d5d1dc70ea1097c40027aa2b2e9d04b4088f5363 100755 (executable)
@@ -53,7 +53,11 @@ namespace MonoTests.System.Data.OleDb {
                }\r
 \r
                [Test]\r
+#if NET_2_0\r
                [ExpectedException (typeof (ArgumentOutOfRangeException))]\r
+#else\r
+               [ExpectedException (typeof (ArgumentException))]\r
+#endif\r
                public void PermissionState_Invalid ()\r
                {\r
                        PermissionState ps = (PermissionState)Int32.MinValue;\r
index 29d09e0e5e2282396218f3ada44a287c954dffc2..6e9fcce2e13fc325d26971be8403c2570345c145 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-14  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * SqlClientPermissionTest.cs, SqlClientPermissionAttributeTest.cs:
+         Fixed some incompatible type of exception between 2.0 and 1.1.
+
 2004-11-01 Gert Driesen <drieseng@users.sourceforge.net>
        * SqlCommandTest.cs: Added testcase for bug #66630.
 
index 8ee1caba3dec01669d0c74552aae0b3fed72dbb8..8c8bf09aeaa56dbbe627363af3273359b9c535c2 100755 (executable)
@@ -146,7 +146,11 @@ namespace MonoTests.System.Data.SqlClient {
                }\r
 \r
                [Test]\r
+#if NET_2_0\r
                [ExpectedException (typeof (ArgumentOutOfRangeException))]\r
+#else\r
+               [ExpectedException (typeof (ArgumentException))]\r
+#endif\r
                public void KeyRestrictionBehavior_Invalid ()\r
                {\r
                        SqlClientPermissionAttribute a = new SqlClientPermissionAttribute (SecurityAction.Assert);\r
index 8cae4741ed8fe0bcfddbfbb4d7621e730f4ff350..81c57db8d356a7feb095088e2152c8b8cba4a40b 100755 (executable)
@@ -52,7 +52,11 @@ namespace MonoTests.System.Data.SqlClient {
                }\r
 \r
                [Test]\r
+#if NET_2_0\r
                [ExpectedException (typeof (ArgumentOutOfRangeException))]\r
+#else\r
+               [ExpectedException (typeof (ArgumentException))]\r
+#endif\r
                public void PermissionState_Invalid ()\r
                {\r
                        PermissionState ps = (PermissionState)Int32.MinValue;\r