diff options
Diffstat (limited to 'mcs/class')
76 files changed, 801 insertions, 349 deletions
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog index 594c2b007f8..38f5670f638 100644 --- a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog +++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog @@ -1,3 +1,8 @@ +2004-10-05 Anirban Bhattacharjee <banirban@novell.com> + * Interaction.cs: + * Strings.cs : + Few important fixes + 2004-07-22 Jambunathan K <kjambunathan@novell.com> * Constants.cs: Fixed definitions of vbCr, vbLf, vbCrLf and diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs index d042be15f78..4d2b278201b 100644 --- a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs +++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs @@ -352,7 +352,7 @@ namespace Microsoft.VisualBasic { string [] args = Environment.GetCommandLineArgs (); if (args != null && args.Length > 1) { - return string.Join (" ", args, 2, args.Length - 1); + return string.Join (" ", args, 1, args.Length - 1); } else { return ""; } diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Strings.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Strings.cs index ae8f92d88ba..86c558eeed8 100644 --- a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Strings.cs +++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Strings.cs @@ -401,7 +401,21 @@ namespace Microsoft.VisualBasic } break; default: - returnstr=Convert.ToDouble(expression).ToString (style); + if (style.IndexOf("X") != -1 + || style.IndexOf("x") != -1 ) { + returnstr = Microsoft.VisualBasic.Conversion.Hex(Convert.ToInt64(expression)); + } + else + try + { + returnstr=Convert.ToDouble(expression).ToString (style); + } + catch (Exception ex){ + style = "0" + style; + returnstr=Convert.ToDouble(expression).ToString (style); + } + + break; } break; @@ -694,6 +708,7 @@ namespace Microsoft.VisualBasic return InStr(1, String1, String2, Compare); } + /// <summary> /// Returns an integer specifying the start position of the first occurrence of one string within another. /// </summary> @@ -826,17 +841,22 @@ namespace Microsoft.VisualBasic [DefaultValue(" ")] string Delimiter) { + try + { + if (SourceArray == null) + throw new ArgumentException("Argument 'SourceArray' can not be null.", "SourceArray"); + if (SourceArray.Rank > 1) + throw new ArgumentException("Argument 'SourceArray' can have only one dimension.", "SourceArray"); - if (SourceArray == null) - throw new ArgumentException("Argument 'SourceArray' can not be null.", "SourceArray"); - if (SourceArray.Rank > 1) - throw new ArgumentException("Argument 'SourceArray' can have only one dimension.", "SourceArray"); - - string[] dest; - dest = new string[SourceArray.Length]; + string[] dest; + dest = new string[SourceArray.Length]; - SourceArray.CopyTo(dest, 0); - return string.Join(Delimiter, dest); + SourceArray.CopyTo(dest, 0); + return string.Join(Delimiter, dest); + } + catch (System.InvalidCastException ie){ + throw new System.ArgumentException("Invalid argument"); + } } /// <summary> @@ -854,8 +874,8 @@ namespace Microsoft.VisualBasic /// <param name="Value">Required. Any valid String or Char expression.</param> public static string LCase(string Value) { - if ((Value == null) || (Value.Length == 0)) - return String.Empty; // VB.net does this. + if ((Value == null) || (Value.Length == 0)) + return Value; // comparing nunit test results say this is an exception to the return String.Empty rule return Value.ToLower(); } @@ -865,16 +885,18 @@ namespace Microsoft.VisualBasic /// Returns a string containing a specified number of characters from the left side of a string. /// </summary> /// <param name="Str">Required. String expression from which the leftmost characters are returned.</param> - /// <param name="Length">Required. Integer expression. Numeric expression indicating how many characters to return. If 0, a zero-length string ("") is returned. If greater than or equal to the number of characters in Str, the entire string is returned.</param> - public static string Left(string Str, - int Length) + /// <param name="Length">Required. Integer expression. Numeric expression indicating how many characters to return. + /// If 0, a zero-length string ("") is returned. If greater than or equal to the number of characters in Str, + /// the entire string is returned.</param> + public static string Left(string Str, int Length) { if (Length < 0) throw new ArgumentException("Argument 'Length' must be non-negative.", "Length"); - if ((Str == null) || (Str.Length == 0)) + if ((Str == null) || (Str.Length == 0) || Length == 0) return String.Empty; // VB.net does this. - - return Str.Substring(0, Length); + if (Length < Str.Length) + return Str.Substring(0, Length); + return Str; } /// <summary> @@ -1202,16 +1224,16 @@ namespace Microsoft.VisualBasic /// </summary> /// <param name="Source">Required. String expression. Name of string variable.</param> /// <param name="Length">Required. Integer expression. Length of returned string.</param> - public static string RSet(string Source, - int Length) + public static string RSet(string Source, int Length) { if (Source == null) Source = String.Empty; if (Length < 0) throw new ArgumentOutOfRangeException("Length", "Length must be non-negative."); - - return Source.PadLeft(Length); + if (Length > Source.Length) + return Source.PadLeft(Length); + return Source.Substring(0, Length); } /// <summary> @@ -1235,7 +1257,7 @@ namespace Microsoft.VisualBasic /// <param name="Compare">Optional. Numeric value indicating the comparison to use when evaluating substrings. See Settings for values.</param> public static string[] Split(string Expression, [Optional] - [DefaultValue(" ")] + [DefaultValue("")] string Delimiter, [Optional] [DefaultValue(-1)] @@ -1245,30 +1267,37 @@ namespace Microsoft.VisualBasic [DefaultValue(CompareMethod.Binary)] CompareMethod Compare) { - - if (Expression == null) return new string[1]; - if ((Delimiter == null) || (Delimiter.Length == 0)) - { + if ((Delimiter == null) || (Delimiter.Length == 0)) { string [] ret = new string[1]; ret[0] = Expression; return ret; } if (Limit == 0) Limit = 1; - - if (Limit < -1) + else if (Limit < -1) throw new OverflowException("Arithmetic operation resulted in an overflow."); - switch (Compare) - { - case CompareMethod.Binary: - return Expression.Split(Delimiter.ToCharArray(0, 1), Limit); - case CompareMethod.Text: - return Expression.Split(Delimiter.ToCharArray(0, 1), Limit); - default: - throw new System.ArgumentException("Argument 'Compare' must be CompareMethod.Binary or CompareMethod.Text.", "Compare"); + + if (Limit != -1) { + switch (Compare){ + case CompareMethod.Binary: + return Expression.Split(Delimiter.ToCharArray(0, 1), Limit); + case CompareMethod.Text: + return Expression.Split(Delimiter.ToCharArray(0, 1), Limit); + default: + throw new System.ArgumentException("Argument 'Compare' must be CompareMethod.Binary or CompareMethod.Text.", "Compare"); + } + } else { + switch (Compare) { + case CompareMethod.Binary: + return Expression.Split(Delimiter.ToCharArray(0, 1)); + case CompareMethod.Text: + return Expression.Split(Delimiter.ToCharArray(0, 1)); + default: + throw new System.ArgumentException("Argument 'Compare' must be CompareMethod.Binary or CompareMethod.Text.", "Compare"); + } } } diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog b/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog index 5299183d037..6ad744e0eb0 100644 --- a/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog @@ -1,3 +1,8 @@ +2004-09-29 Sebastien Pouliot <sebastien@ximian.com> + + * RSAManaged.cs: KeySize is now always a multiple of 8 bits. + Fix #66929. + 2004-06-23 Sebastien Pouliot <sebastien@ximian.com> * SymmetricTransform.cs: Reduce by one the number of block when diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/RSAManaged.cs b/mcs/class/Mono.Security/Mono.Security.Cryptography/RSAManaged.cs index 79771634302..82b16f6b291 100644 --- a/mcs/class/Mono.Security/Mono.Security.Cryptography/RSAManaged.cs +++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/RSAManaged.cs @@ -14,6 +14,8 @@ // // +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including @@ -147,8 +149,12 @@ namespace Mono.Security.Cryptography { public override int KeySize { get { // in case keypair hasn't been (yet) generated - if (keypairGenerated) - return n.BitCount (); + if (keypairGenerated) { + int ks = n.BitCount (); + if ((ks & 7) != 0) + ks = ks + (8 - (ks & 7)); + return ks; + } else return base.KeySize; } diff --git a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ChangeLog b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ChangeLog index a5a20358101..971879f8b9a 100644 --- a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ChangeLog @@ -1,3 +1,12 @@ +2004-10-05 Sebastien Pouliot <sebastien@ximian.com> + + * SslClientStream.cs: Changed InputBuffer to internal (was protected). + +2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpsClientStream.cs: the .ctor receives a pre-read buffer now. + * SslClientStream.cs: added InputBuffer property. + 2004-07-14 Sebastien Pouliot <sebastien@ximian.com> * SslClientStream.cs: Changed lock to "new object()" and not diff --git a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs index 678cf83163c..89562c9b416 100644 --- a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs +++ b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs @@ -44,12 +44,14 @@ namespace Mono.Security.Protocol.Tls { public HttpsClientStream (Stream stream, X509CertificateCollection clientCertificates, - HttpWebRequest request) + HttpWebRequest request, byte [] buffer) : base (stream, request.RequestUri.Host, false, SecurityProtocolType.Default, clientCertificates) { // this constructor permit access to the WebRequest to call // ICertificatePolicy.CheckValidationResult _request = request; + if (buffer != null) + InputBuffer.Write (buffer, 0, buffer.Length); #if !NET_1_0 // also saved from reflection base.CheckCertRevocationStatus = ServicePointManager.CheckCertificateRevocationList; @@ -71,3 +73,4 @@ namespace Mono.Security.Protocol.Tls { } } } + diff --git a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs index fccfb9902b3..18cc041f4a4 100644 --- a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs +++ b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs @@ -125,6 +125,10 @@ namespace Mono.Security.Protocol.Tls set { throw new NotSupportedException(); } } + // required by HttpsClientStream for proxy support + internal Stream InputBuffer { + get { return inputBuffer; } + } #endregion #region Security Properties diff --git a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog index 8cbc2916c38..8b39fed6e74 100755 --- a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog +++ b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog @@ -1,3 +1,7 @@ +2004-09-24 Umadevi S <sumadevi@novell.com> + * SqlTransaction.cs - Dispose will not call rollback incase the transaction is not open. + + 2004-09-02 Umadevi S <sumadevi@novell.com> * SqlCommand.cs - ExecuteNonQuery to return -1 incase of executing a storedprocedure diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs index f6c1ad13f5c..aa145d2c426 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs @@ -94,7 +94,8 @@ namespace System.Data.SqlClient { { if (!disposed) { if (disposing) { - Rollback (); + if (isOpen) + Rollback (); } disposed = true; } diff --git a/mcs/class/System.Data/System.Data/ChangeLog b/mcs/class/System.Data/System.Data/ChangeLog index 16ad51b1bae..c1212daff3f 100644 --- a/mcs/class/System.Data/System.Data/ChangeLog +++ b/mcs/class/System.Data/System.Data/ChangeLog @@ -1,3 +1,37 @@ +2004-10-08 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : Yesterday's fix was different and broke the build :( + +2004-10-07 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : + - When AllowDBNull is false on attribute DataColumn, its schema + should contain use="required". This fixes bug #66792. + - If MaxLength is set on attribute DataColumn, the mapped schema + type should contain maxLength facet. This fixes bug #66793. + +2004-10-04 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : For a row, when a relation is not nested, then it is + still output target since it won't be written as a child of its + parent. It fixes bug #66379. + +2004-10-03 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : Attribute constraint field XPath must be written as + @blah. This fixes bug #66366. + +2004-09-28 Umadevi S <sumadevi@novell.com> + * DataRow.cs - checked for Enforceconstraints, while using indices to search for related rows + +2004-09-24 Sureshkumar T <tsureshkumar@novell.com> + + * DataSet.cs : Don't check constraints for dataset clear + * DataRowCollection.cs : check for EnforceConstraints flag + before checking foriegn key constraints in Clear method + * DataTable.cs : Redundant checking removed in Clear method as it is + checked in DataRowCollection.Clear method. + 2004-09-21 Sureshkumar T <tsureshkumar@novell.com> * DataRow.cs: Added a new original row cache, if the current row happens diff --git a/mcs/class/System.Data/System.Data/DataRow.cs b/mcs/class/System.Data/System.Data/DataRow.cs index 00bb0d1bdbd..49c59a922db 100644 --- a/mcs/class/System.Data/System.Data/DataRow.cs +++ b/mcs/class/System.Data/System.Data/DataRow.cs @@ -1038,7 +1038,9 @@ namespace System.Data { int numColumn = parentColumns.Length; if (HasVersion(version)) { Index indx = relation.ParentTable.GetIndexByColumns (parentColumns); - if (indx != null) { // get the child rows from the index + if (indx != null && + (Table == null || Table.DataSet == null || + Table.DataSet.EnforceConstraints)) { // get the child rows from the index Node[] childNodes = indx.FindAllSimple(childColumns, IndexFromVersion(version)); for (int i = 0; i < childNodes.Length; i++) { rows.Add (childNodes[i].Row); diff --git a/mcs/class/System.Data/System.Data/DataRowCollection.cs b/mcs/class/System.Data/System.Data/DataRowCollection.cs index 06e94a354b3..8b1d2e20190 100644 --- a/mcs/class/System.Data/System.Data/DataRowCollection.cs +++ b/mcs/class/System.Data/System.Data/DataRowCollection.cs @@ -123,7 +123,7 @@ namespace System.Data /// </summary> public void Clear () { - if (this.table.DataSet != null) + if (this.table.DataSet != null && this.table.DataSet.EnforceConstraints) { foreach (DataTable table in this.table.DataSet.Tables) { diff --git a/mcs/class/System.Data/System.Data/DataSet.cs b/mcs/class/System.Data/System.Data/DataSet.cs index 8ac4d34836b..60b1680e73b 100644 --- a/mcs/class/System.Data/System.Data/DataSet.cs +++ b/mcs/class/System.Data/System.Data/DataSet.cs @@ -330,13 +330,19 @@ namespace System.Data { tempTable.AcceptChanges (); } + /// <summary> + /// Clears all the tables + /// </summary> public void Clear () { if (_xmlDataDocument != null) throw new NotSupportedException ("Clear function on dataset and datatable is not supported when XmlDataDocument is bound to the DataSet."); - for (int t = 0; t < tableCollection.Count; t++) { - tableCollection[t].Clear (); + bool enforceConstraints = this.EnforceConstraints; + this.EnforceConstraints = false; + for (int t = 0; t < tableCollection.Count; t++) { + tableCollection [t].Clear (); } + this.EnforceConstraints = enforceConstraints; } public virtual DataSet Clone () @@ -1188,16 +1194,22 @@ namespace System.Data { case 0: break; case 1: + if (!oneRel.Nested) + break; if (row.GetParentRow (oneRel) != null) continue; break; case 2: bool skip = false; - for (int i = 0; i < table.ParentRelations.Count; i++) - if (row.GetParentRow (table.ParentRelations [i]) != null) { + for (int i = 0; i < table.ParentRelations.Count; i++) { + DataRelation prel = table.ParentRelations [i]; + if (!prel.Nested) + continue; + if (row.GetParentRow (prel) != null) { skip = true; continue; } + } if (skip) continue; break; @@ -1539,7 +1551,8 @@ namespace System.Data { XmlSchemaXPath field; foreach (DataColumn column in uqConst.Columns) { field = new XmlSchemaXPath(); - field.XPath = constraintPrefix+column.ColumnName; + string typePrefix = column.ColumnMapping == MappingType.Attribute ? "@" : ""; + field.XPath = typePrefix + constraintPrefix + column.ColumnName; uniq.Fields.Add(field); } @@ -1606,7 +1619,8 @@ namespace System.Data { XmlSchemaXPath field; foreach (DataColumn column in rel.ChildColumns) { field = new XmlSchemaXPath(); - field.XPath = constraintPrefix+column.ColumnName; + string typePrefix = column.ColumnMapping == MappingType.Attribute ? "@" : ""; + field.XPath = typePrefix + constraintPrefix + column.ColumnName; keyRef.Fields.Add(field); } @@ -1753,8 +1767,20 @@ namespace System.Data { // FIXME: Handle prefix mapping correctly. schemaToAdd.Namespaces.Add (prefix, col.Namespace); } - att.SchemaTypeName = MapType (col.DataType); + if (!col.AllowDBNull) + att.Use = XmlSchemaUse.Required; + + if (col.MaxLength > -1) + att.SchemaType = GetTableSimpleType (doc, col); + else + att.SchemaTypeName = MapType (col.DataType); // FIXME: what happens if extended properties are set on attribute columns?? + if (!col.AllowDBNull) + att.Use = XmlSchemaUse.Required; + if (col.MaxLength > -1) + att.SchemaType = GetTableSimpleType (doc, col); + else + att.SchemaTypeName = MapType (col.DataType); schemaAttributes.Add (att); } diff --git a/mcs/class/System.Data/System.Data/DataTable.cs b/mcs/class/System.Data/System.Data/DataTable.cs index c8f06e7ec0b..344d928f2ec 100644 --- a/mcs/class/System.Data/System.Data/DataTable.cs +++ b/mcs/class/System.Data/System.Data/DataTable.cs @@ -677,37 +677,7 @@ namespace System.Data { /// Clears the DataTable of all data. /// </summary> public void Clear () { - // TODO: thow an exception if any rows that - // have enforced child relations - // that would result in child rows being orphaned - // now we check if any ForeignKeyConstraint is referncing 'table'. - if (DataSet != null) - { - if (DataSet._xmlDataDocument != null) - throw new NotSupportedException ("Clear function on dataset and datatable is not supported on XmlDataDocument."); - - IEnumerator tableEnumerator = DataSet.Tables.GetEnumerator(); - - // loop on all tables in dataset - while (tableEnumerator.MoveNext()) - { - IEnumerator constraintEnumerator = ((DataTable) tableEnumerator.Current).Constraints.GetEnumerator(); - // loop on all constrains in the current table - while (constraintEnumerator.MoveNext()) - { - Object o = constraintEnumerator.Current; - // we only check ForeignKeyConstraint - if (o is ForeignKeyConstraint) - { - ForeignKeyConstraint fc = (ForeignKeyConstraint) o; - if(fc.RelatedTable == this && fc.Table.Rows.Count > 0) - throw new InvalidConstraintException("Cannot clear table " + fc.RelatedTable + " because ForeignKeyConstraint " + fc.ConstraintName + " enforces constraints and there are child rows in " + fc.Table); - } - } - } - } - - + // Foriegn key constraints are checked in _rows.Clear method _rows.Clear (); } diff --git a/mcs/class/System.Data/Test/System.Data.SqlClient/SqlTransactionTest.cs b/mcs/class/System.Data/Test/System.Data.SqlClient/SqlTransactionTest.cs new file mode 100644 index 00000000000..c91e27631cc --- /dev/null +++ b/mcs/class/System.Data/Test/System.Data.SqlClient/SqlTransactionTest.cs @@ -0,0 +1,85 @@ +//
+// SqlTransactionTest.cs - NUnit Test Cases for testing the
+// SqlTransaction class
+// Author:
+// Umadevi S (sumadevi@novell.com)
+//
+// Copyright (c) 2004 Novell Inc., and the individuals listed
+// on the ChangeLog entries.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Data;
+using System.Data.Common; +using System.Data.SqlClient;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient +{
+
+ [TestFixture]
+ public class SqlTransactionTest : MSSqlTestClient {
+
+ [SetUp]
+ public void GetReady () {
+ OpenConnection ();
+ }
+
+ [TearDown]
+ public void Clean () {
+ CloseConnection ();
+ } + + [Test]
+ /** + The below test expects a table table4 with a bigint column. + **/ + public void TransactionCommitTest () { + + using (SqlTransaction transaction = conn.BeginTransaction()) + { + try + { + string sSql = "Insert into Region(RegionID,RegionDescription) Values ('10112', 'NovellBangalore')"; + SqlCommand command = new SqlCommand(); + command.Connection = conn; + command.CommandText = sSql; + command.Transaction = transaction; + command.CommandType = CommandType.Text; + command.ExecuteNonQuery(); + transaction.Commit(); + } + catch (System.Exception ex) + { + transaction.Rollback(); + } + finally + { + conn.Close(); + } + + } + } + + }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/ChangeLog b/mcs/class/System.Data/Test/System.Data/ChangeLog index 81049665e9d..07f46872aea 100644 --- a/mcs/class/System.Data/Test/System.Data/ChangeLog +++ b/mcs/class/System.Data/Test/System.Data/ChangeLog @@ -1,3 +1,11 @@ +2004-09-24 Umadevi S <sumadevi@novell.com> + * DataRowTest.cs : Added a test for EnforceConstraints with relations defined. + +2004-09-24 Sureshkumar T <tsureshkumar@novell.com> + + * DataSetTest.cs (DataSetClearTest): Added a test for DataSet.Clear. This should not + throw any exception and should override constraints. + 2004-09-21 Sureshkumar T <tsureshkumar@novell.com> * DataSetTest.cs : Added a test for Deserialization of dataset : DeserializeModifiedDataSet diff --git a/mcs/class/System.Data/Test/System.Data/DataRowTest.cs b/mcs/class/System.Data/Test/System.Data/DataRowTest.cs index a82637dc9cd..2f347ddd005 100644 --- a/mcs/class/System.Data/Test/System.Data/DataRowTest.cs +++ b/mcs/class/System.Data/Test/System.Data/DataRowTest.cs @@ -756,5 +756,42 @@ namespace MonoTests.System.Data dt.Columns.Add (col);
dt.Rows [0] [0] = "test"; } + + [Test] + public void EnforceConstraint () + { + int id = 100; + // Setup stuff + DataSet ds = new DataSet(); + DataTable parent = ds.Tables.Add("parent"); + parent.Columns.Add("id", typeof(int)); + DataTable child = ds.Tables.Add("child"); + child.Columns.Add("idref", typeof(int)); + Constraint uniqueId = null; + parent.Constraints.Add(uniqueId = new UniqueConstraint("uniqueId", + new DataColumn[] {parent.Columns["id"]}, true)); + ForeignKeyConstraint fkc = new ForeignKeyConstraint("ParentChildConstraint", new DataColumn[] { parent.Columns["id"] }, + new DataColumn[] { child.Columns["idref"]}); + + child.Constraints.Add(fkc); + + DataRelation relateParentChild = new DataRelation("relateParentChild", + new DataColumn[] {parent.Columns["id"] }, + new DataColumn[] {child.Columns["idref"] }, + false); + ds.Relations.Add(relateParentChild); + + ds.EnforceConstraints = false; + DataRow parentRow = parent.Rows.Add(new object[] { id }); + DataRow childRow = child.Rows.Add(new object[] { id }); + if (parentRow == childRow.GetParentRow(relateParentChild)) { + foreach(DataColumn dc in parent.Columns) + AssertEquals(100,parentRow[dc]); + + } + + + } + } } diff --git a/mcs/class/System.Data/Test/System.Data/DataSetTest.cs b/mcs/class/System.Data/Test/System.Data/DataSetTest.cs index ff63be88baf..95c6c3061a7 100644 --- a/mcs/class/System.Data/Test/System.Data/DataSetTest.cs +++ b/mcs/class/System.Data/Test/System.Data/DataSetTest.cs @@ -1269,5 +1269,40 @@ namespace MonoTests.System.Data prevDs.Tables[0].Rows [0][0,DataRowVersion.Current].ToString (), ds.Tables[0].Rows [0][0,DataRowVersion.Current].ToString ()); } + + /// <summary> + /// Test for testing DataSet.Clear method with foriegn key relations + /// This is expected to clear all the related datatable rows also + /// </summary> + [Test] + public void DataSetClearTest () + { + DataSet ds = new DataSet (); + DataTable parent = ds.Tables.Add ("Parent"); + DataTable child = ds.Tables.Add ("Child"); + + parent.Columns.Add ("id", typeof (int)); + child.Columns.Add ("ref_id", typeof(int)); + + child.Constraints.Add (new ForeignKeyConstraint ("fk_constraint", parent.Columns [0], child.Columns [0])); + + DataRow dr = parent.NewRow (); + dr [0] = 1; + parent.Rows.Add (dr); + dr.AcceptChanges (); + + dr = child.NewRow (); + dr [0] = 1; + child.Rows.Add (dr); + dr.AcceptChanges (); + + try { + ds.Clear (); // this should clear all the rows in parent & child tables + } catch (Exception e) { + throw (new Exception ("Exception should not have been thrown at Clear method" + e.ToString ())); + } + Assertion.AssertEquals ("parent table rows should not exist!", 0, parent.Rows.Count); + Assertion.AssertEquals ("child table rows should not exist!", 0, child.Rows.Count); + } } } diff --git a/mcs/class/System.Drawing/System.Drawing/ChangeLog b/mcs/class/System.Drawing/System.Drawing/ChangeLog index 86128fba395..48b2c8a2537 100644 --- a/mcs/class/System.Drawing/System.Drawing/ChangeLog +++ b/mcs/class/System.Drawing/System.Drawing/ChangeLog @@ -1,3 +1,7 @@ +2004-10-04 Ravindra <rkumar@novell.com> + + * gdipFunctioncs.cs: Backporting. Fix from Alois for bug #67383. + 2004-09-22 Ravindra <rkumar@novell.com> * gdipFunctions.cs: Backporting. Improved the exception message diff --git a/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs b/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs index 860d28692c6..8c408cd58fb 100644 --- a/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs +++ b/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs @@ -1416,8 +1416,9 @@ namespace System.Drawing public GdiPlusStreamHelper (Stream s) { - stream = s; - stream.Seek(0, SeekOrigin.Begin); + stream = s; + if (stream.CanSeek) + stream.Seek (0, SeekOrigin.Begin); } public int StreamGetBytesImpl (IntPtr buf, int bufsz, bool peek) diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog index 8b0776c0c38..6519e52d14e 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog @@ -1,3 +1,8 @@ +2004-09-28 Lluis Sanchez Gual <lluis@novell.com> + + * WebServiceHelper.cs: Write the encodingStyle attribute when using the + encoded format. This fixes bug #66908. + 2004-08-25 Lluis Sanchez Gual <lluis@novell.com> * HttpSoapWebServiceHandler.cs, WebServiceHandler.cs: Do not assign the diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs index 309cdccf7c4..3c2efcfbfc1 100755 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs @@ -118,6 +118,10 @@ namespace System.Web.Services.Protocols // Serialize body xtw.WriteStartElement ("soap", "Body", WebServiceHelper.SoapEnvelopeNamespace); + + if (methodUse == SoapBindingUse.Encoded) + xtw.WriteAttributeString ("encodingStyle", WebServiceHelper.SoapEnvelopeNamespace, "http://schemas.xmlsoap.org/soap/encoding/"); + bodySerializer.Serialize (xtw, bodyContent); xtw.WriteEndElement (); diff --git a/mcs/class/System.Web/System.Web.Caching/Cache.cs b/mcs/class/System.Web/System.Web.Caching/Cache.cs index b8ecda5dd90..720d86c71ca 100644 --- a/mcs/class/System.Web/System.Web.Caching/Cache.cs +++ b/mcs/class/System.Web/System.Web.Caching/Cache.cs @@ -209,7 +209,7 @@ namespace System.Web.Caching { // If we have any kind of expiration add into the CacheExpires class if (objEntry.HasSlidingExpiration || objEntry.HasAbsoluteExpiration) { if (objEntry.HasSlidingExpiration) - objEntry.Expires = DateTime.Now.Ticks + objEntry.SlidingExpiration; + objEntry.Expires = DateTime.UtcNow.Ticks + objEntry.SlidingExpiration; _objExpires.Add (objEntry); } @@ -392,7 +392,7 @@ namespace System.Web.Caching { internal CacheEntry GetEntry (string strKey) { CacheEntry objEntry = null; - long ticksNow = DateTime.Now.Ticks; + long ticksNow = DateTime.UtcNow.Ticks; if (strKey == null) throw new ArgumentNullException ("strKey"); diff --git a/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs b/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs index 0e07353dc56..10e0f7c57a0 100644 --- a/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs +++ b/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs @@ -100,7 +100,7 @@ namespace System.Web.Caching { // moved after each period, and the absolute expiration is the value used
// for all expiration calculations.
if (tsSpan.Ticks != Cache.NoSlidingExpiration.Ticks)
- _ticksExpires = System.DateTime.Now.AddTicks(_ticksSlidingExpiration).Ticks;
+ _ticksExpires = System.DateTime.UtcNow.AddTicks(_ticksSlidingExpiration).Ticks;
_objDependency = objDependency;
if (_objDependency != null)
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs b/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs index 673468ae209..11e2377e3c1 100644 --- a/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs +++ b/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs @@ -71,7 +71,7 @@ namespace System.Web.Caching { } while (bytePos < 60);
// GC Bucket controller
- _intFlush = System.DateTime.Now.Minute - 1;
+ _intFlush = System.DateTime.UtcNow.Minute - 1;
_objTimer = new System.Threading.Timer (new System.Threading.TimerCallback (GarbageCleanup), null, 10000, 60000);
}
@@ -80,7 +80,7 @@ namespace System.Web.Caching { /// </summary>
/// <param name="objEntry">Cache entry to add.</param>
internal void Add (CacheEntry objEntry) {
- long now = DateTime.Now.Ticks;
+ long now = DateTime.UtcNow.Ticks;
if (objEntry.Expires < now)
objEntry.Expires = now;
diff --git a/mcs/class/System.Web/System.Web.Caching/ChangeLog b/mcs/class/System.Web/System.Web.Caching/ChangeLog index 3b09664543a..1b19523286f 100644 --- a/mcs/class/System.Web/System.Web.Caching/ChangeLog +++ b/mcs/class/System.Web/System.Web.Caching/ChangeLog @@ -1,3 +1,8 @@ +2004-10-03 Ben Maurer <bmaurer@ximian.com> + + * Cache.cs, CacheEntry.cs, CacheExpires.cs, ExpiresBuckets.cs: + use UtcNow rather than Now. + 2004-05-27 Patrik Torstensson <totte@hiddenpeaks.com> * ExpiresBucket.cs (FlushExpiredItems): fix csc and a typo bug diff --git a/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs index e32194c836c..7b8c139afeb 100644 --- a/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs +++ b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs @@ -231,7 +231,7 @@ namespace System.Web.Caching { int intPos;
long ticksNow;
- ticksNow = DateTime.Now.Ticks;
+ ticksNow = DateTime.UtcNow.Ticks;
intPos = 0;
// Lookup all items that needs to be removed, this is done in a two part
diff --git a/mcs/class/System.Web/System.Web.Compilation/BuildProviderResultFlags.cs b/mcs/class/System.Web/System.Web.Compilation/BuildProviderResultFlags.cs deleted file mode 100644 index 3cd3ea5723a..00000000000 --- a/mcs/class/System.Web/System.Web.Compilation/BuildProviderResultFlags.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -// System.Web.Compilation.BuildProviderResultFlags.cs -// -// Authors: -// Duncan Mak (duncan@ximian.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// - -using System.Resources; - -#if NET_2_0 -namespace System.Web.Compilation -{ - [Serializable, Flags] - public enum BuildProviderResultFlags - { - Default = 0, - ShutdownAppDomainOnChange = 1 - } -} -#endif diff --git a/mcs/class/System.Web/System.Web.Compilation/IImplicitResourceProvider.cs b/mcs/class/System.Web/System.Web.Compilation/IImplicitResourceProvider.cs deleted file mode 100644 index 3e2c38ff5db..00000000000 --- a/mcs/class/System.Web/System.Web.Compilation/IImplicitResourceProvider.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -// System.Web.Compilation.IImplicitResourceProvider.cs -// -// Authors: -// Duncan Mak (duncan@ximian.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// - -#if NET_2_0 - -using System.Collections; -using System.Globalization; - -namespace System.Web.Compilation -{ - public interface IImplicitResourceProvider - { - object GetObject (ImplicitResourceKey key, CultureInfo culture); - ICollection GetResources (string keyPrefix); - } -} -#endif diff --git a/mcs/class/System.Web/System.Web.Compilation/IResourceReader.cs b/mcs/class/System.Web/System.Web.Compilation/IResourceReader.cs deleted file mode 100644 index 4cdb8b14784..00000000000 --- a/mcs/class/System.Web/System.Web.Compilation/IResourceReader.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// System.Web.Compilation.IResourceProvider.cs -// -// Authors: -// Duncan Mak (duncan@ximian.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// - -using System.Resources; - -#if NET_2_0 -namespace System.Web.Compilation -{ - public interface IResourceProvider - { - IResourceReader ResourceReader { get; } - } -} -#endif diff --git a/mcs/class/System.Web/System.Web.Compilation/ImplicitResourceKey.cs b/mcs/class/System.Web/System.Web.Compilation/ImplicitResourceKey.cs deleted file mode 100644 index ac2bab3c256..00000000000 --- a/mcs/class/System.Web/System.Web.Compilation/ImplicitResourceKey.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// System.Web.Compilation.IImplicitResourceProvider.cs -// -// Authors: -// Duncan Mak (duncan@ximian.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// - -#if NET_2_0 -namespace System.Web.Compilation -{ - public class ImplicitResourceKey - { - public ImplicitResourceKey () - { - } - - public string Filter; - public string KeyPrefix; - public string Property; - } -} -#endif diff --git a/mcs/class/System.Web/System.Web.Handlers/ChangeLog b/mcs/class/System.Web/System.Web.Handlers/ChangeLog index 50459bd9024..4f3e185e220 100644 --- a/mcs/class/System.Web/System.Web.Handlers/ChangeLog +++ b/mcs/class/System.Web/System.Web.Handlers/ChangeLog @@ -1,3 +1,8 @@ +2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TraceHandler.cs: error code is 403 and the message different when + trace is enabled but not for remote clients. + 2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TraceHandler.cs: check that trace is enabled or throw. diff --git a/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs index 343aa5957a7..23e35288f80 100644 --- a/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs +++ b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs @@ -44,11 +44,21 @@ namespace System.Web.Handlers #endif class TraceNotAvailableException : HttpException { - public TraceNotAvailableException () : - base ("Trace Error") {} + bool notLocal; + + public TraceNotAvailableException (bool notLocal) : + base (notLocal ? 403 : 500, "Trace Error") + { + this.notLocal = notLocal; + } internal override string Description { - get { return "Trace.axd is not enabled in the configuration file for this application."; } + get { + if (notLocal) + return "Trace is not enabled for remote clients."; + + return "Trace.axd is not enabled in the configuration file for this application."; + } } } @@ -58,9 +68,8 @@ namespace System.Web.Handlers { TraceManager manager = HttpRuntime.TraceManager; - if (!manager.Enabled || manager.LocalOnly && !context.Request.IsLocal) { - throw new TraceNotAvailableException (); - } + if (!manager.Enabled || manager.LocalOnly && !context.Request.IsLocal) + throw new TraceNotAvailableException (manager.Enabled); HtmlTextWriter output = new HtmlTextWriter (context.Response.Output); diff --git a/mcs/class/System.Web/System.Web.SessionState/ChangeLog b/mcs/class/System.Web/System.Web.SessionState/ChangeLog index b8e60f21cdd..65d40fbe0bc 100644 --- a/mcs/class/System.Web/System.Web.SessionState/ChangeLog +++ b/mcs/class/System.Web/System.Web.SessionState/ChangeLog @@ -1,3 +1,7 @@ +2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * SessionStateModule.cs: use SetCurrentExePath instead of SetFilePath. + 2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com> * HttpSessionState.cs: don't share static session objects declared in diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs b/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs index cbee9af88f8..c909e2a4086 100644 --- a/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs +++ b/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs @@ -109,7 +109,7 @@ namespace System.Web.SessionState if (id == null) return; - context.Request.SetFilePath (UrlUtils.RemoveSessionId (base_path, + context.Request.SetCurrentExePath (UrlUtils.RemoveSessionId (base_path, context.Request.FilePath)); context.Request.SetHeader (HeaderName, id); } diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs index 0777e266fc4..de46e7d14ac 100755 --- a/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs @@ -217,7 +217,7 @@ namespace System.Web.UI.WebControls [Bindable(true)] [DefaultValue("")] [Editor ("System.Web.UI.Design.XmlUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))] - [WebCategory("Behaviour")] + [WebCategory("Behavior")] [WebSysDescription("AdRotator_AdvertisementFile")] public string AdvertisementFile { get { return ((advertisementFile != null) ? advertisementFile : ""); } @@ -232,7 +232,7 @@ namespace System.Web.UI.WebControls [Bindable(true)] [DefaultValue("")] - [WebCategory("Behaviour")] + [WebCategory("Behavior")] [WebSysDescription("AdRotator_KeywordFilter")] public string KeywordFilter { get { @@ -251,7 +251,7 @@ namespace System.Web.UI.WebControls [Bindable(true)] [DefaultValue("")] [TypeConverter(typeof(TargetConverter))] - [WebCategory("Behaviour")] + [WebCategory("Behavior")] [WebSysDescription("AdRotator_Target")] public string Target { get { diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs index 86de6a314f5..83ac1c850cc 100755 --- a/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs @@ -56,7 +56,7 @@ namespace System.Web.UI.WebControls } [DefaultValue(ValidationDataType.String)] - [WebCategory("Behaviour")] + [WebCategory("Behavior")] [WebSysDescription("RangeValidator_Type")] public ValidationDataType Type { diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog index 874a1774bce..632b24ace91 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog @@ -1,3 +1,7 @@ +2004-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TableStyle.cs: don't render empty 'rules' attribute (again). + 2004-09-12 Gonzalo Paniagua Javier <gonzalo@ximian.com> * RadioButton.cs: fix GroupName when the control is inside a diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs index 413b8a0745c..a1653a11928 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs @@ -171,7 +171,7 @@ namespace System.Web.UI.WebControls {
writer.AddAttribute(HtmlTextWriterAttribute.Align, Enum.Format(typeof(HorizontalAlign), HorizontalAlign, "G"));
}
- string gd = String.Empty; + string gd = null; switch(GridLines)
{
case GridLines.None: break; @@ -182,6 +182,8 @@ namespace System.Web.UI.WebControls case GridLines.Both: gd = "all";
break;
} + + if (gd != null) writer.AddAttribute(HtmlTextWriterAttribute.Rules, gd); } diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog index ee8644d5f3c..4f16a45684a 100644 --- a/mcs/class/System.Web/System.Web.UI/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI/ChangeLog @@ -1,3 +1,8 @@ +2004-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Control.cs: even if the control has no children the naming container + may contain the control we're looking for. Fixes bug #67304. + 2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TemplateParser.cs: ensure bin directory exists before trying to access diff --git a/mcs/class/System.Web/System.Web.UI/Control.cs b/mcs/class/System.Web/System.Web.UI/Control.cs index b2d3ada71f2..da9aac46dc8 100644 --- a/mcs/class/System.Web/System.Web.UI/Control.cs +++ b/mcs/class/System.Web/System.Web.UI/Control.cs @@ -501,9 +501,6 @@ namespace System.Web.UI protected virtual Control FindControl (string id, int pathOffset)
{
EnsureChildControls ();
- if (_controls == null)
- return null;
-
Control namingContainer = null;
if (!_isNamingContainer) {
namingContainer = NamingContainer;
@@ -512,7 +509,10 @@ namespace System.Web.UI return namingContainer.FindControl (id, pathOffset);
}
-
+ + if (!HasControls ()) + return null; + int colon = id.IndexOf (':', pathOffset);
if (colon == -1)
return LookForControlByName (id.Substring (pathOffset));
diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog index 01478566763..9bfa82351cf 100644 --- a/mcs/class/System.Web/System.Web/ChangeLog +++ b/mcs/class/System.Web/System.Web/ChangeLog @@ -1,3 +1,36 @@ +2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpRequest.cs: CurrentExecutionFilePath is the one that + changes when Transfer or Execute are used, not FilePath. + + * HttpServerUtility.cs: moved form saving/restoring from + Transfer to Execute, as it's needed there too. the query string is + correctly set now. Fixes bug #67388. + + * HttpContext.cs: use SetCurrentExePath instead of SetFilePath. + +2004-10-03 Ben Maurer <bmaurer@ximian.com> + + * HttpResponse.cs: use UtcNow + +2004-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpResponse.cs: SuppressContent does not throw and clears all the + buffered output. Fixes bug #67213. + +2004-09-30 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpUtility.cs: UrlPathEncode is static. Fixes bug #67155. + +2004-09-29 Ben Maurer <bmaurer@ximian.com> + + * HttpContext.cs, TimeoutManager: Use DateTime.UtcNow. + +2004-09-25 Ben Maurer <bmaurer@ximian.com> + + * HttpApplication.cs: Make sure requests are removed from + the timeout manager. Fixes a major leak. #66751. + 2004-09-24 Gonzalo Paniagua Javier <gonzalo@ximian.com> * HttpApplicationFactory.cs: diff --git a/mcs/class/System.Web/System.Web/HttpApplication.cs b/mcs/class/System.Web/System.Web/HttpApplication.cs index 37599a8e1f0..91dfda2ae8d 100644 --- a/mcs/class/System.Web/System.Web/HttpApplication.cs +++ b/mcs/class/System.Web/System.Web/HttpApplication.cs @@ -664,19 +664,23 @@ namespace System.Web handler = _handlers [_currentStateIdx]; _countSteps++; timeoutPossible = handler.PossibleToTimeout; - if (timeoutPossible) - HttpRuntime.TimeoutManager.Add (_app.Context); - - lasterror = ExecuteState (handler, ref ready_sync); - if (ready_sync) - _countSyncSteps++; + try { + if (timeoutPossible) + HttpRuntime.TimeoutManager.Add (_app.Context); + + lasterror = ExecuteState (handler, ref ready_sync); + if (ready_sync) + _countSyncSteps++; + } finally { + if (timeoutPossible) + HttpRuntime.TimeoutManager.Remove (_app.Context); + } } while (ready_sync && _currentStateIdx < _endStateIdx); if (null != lasterror) _app.HandleError (lasterror); } finally { - if (timeoutPossible) - HttpRuntime.TimeoutManager.Remove (_app.Context); + _app.OnStateExecuteLeave (); } diff --git a/mcs/class/System.Web/System.Web/HttpContext.cs b/mcs/class/System.Web/System.Web/HttpContext.cs index 27ca76ff8a5..4d28af400ad 100644 --- a/mcs/class/System.Web/System.Web/HttpContext.cs +++ b/mcs/class/System.Web/System.Web/HttpContext.cs @@ -287,7 +287,7 @@ namespace System.Web internal void BeginTimeoutPossible () { timeoutPossible = 1; - timeoutBegin = DateTime.Now.Ticks; + timeoutBegin = DateTime.UtcNow.Ticks; } internal void EndTimeoutPossible () @@ -403,7 +403,7 @@ namespace System.Web throw new HttpException (404, "The virtual path '" + path + "' maps to another application."); - Request.SetFilePath (path); + Request.SetCurrentExePath (path); Request.QueryStringRaw = query; } diff --git a/mcs/class/System.Web/System.Web/HttpRequest.cs b/mcs/class/System.Web/System.Web/HttpRequest.cs index 5b1cbef349c..48140d4c1f9 100644 --- a/mcs/class/System.Web/System.Web/HttpRequest.cs +++ b/mcs/class/System.Web/System.Web/HttpRequest.cs @@ -88,6 +88,7 @@ namespace System.Web { Stream userFilter; HttpRequestStream requestFilter; string clientTarget; + string currentExePath; #if NET_1_1 bool validateCookies; bool validateForm; @@ -503,6 +504,9 @@ namespace System.Web { public string CurrentExecutionFilePath { get { + if (currentExePath != null) + return currentExePath; + return FilePath; } } @@ -1139,9 +1143,9 @@ namespace System.Web { } #endif - internal void SetFilePath (string filePath) + internal void SetCurrentExePath (string filePath) { - _sFilePath = filePath; + currentExePath = filePath; _sRequestRootVirtualDir = null; baseVirtualDir = null; } diff --git a/mcs/class/System.Web/System.Web/HttpResponse.cs b/mcs/class/System.Web/System.Web/HttpResponse.cs index 45128ce4415..fa8c2892af8 100644 --- a/mcs/class/System.Web/System.Web/HttpResponse.cs +++ b/mcs/class/System.Web/System.Web/HttpResponse.cs @@ -190,7 +190,7 @@ namespace System.Web CultureInfo oSavedInfo = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; - string date = DateTime.Now.ToUniversalTime ().ToString ("ddd, d MMM yyyy HH:mm:ss "); + string date = DateTime.UtcNow.ToString ("ddd, d MMM yyyy HH:mm:ss "); HttpResponseHeader date_header = new HttpResponseHeader ("Date", date + "GMT"); oHeaders.Add (date_header); @@ -618,9 +618,6 @@ namespace System.Web } set { - if (_bHeadersSent) - throw new HttpException ("Headers has been sent to the client"); - _bSuppressContent = true; } } @@ -846,6 +843,9 @@ namespace System.Web if (!_bSuppressContent && Request.HttpMethod == "HEAD") _bSuppressContent = true; + if (_bSuppressContent) + _Writer.Clear (); + if (!_bSuppressContent) { _bClientDisconnected = false; if (_bChunked) { diff --git a/mcs/class/System.Web/System.Web/HttpServerUtility.cs b/mcs/class/System.Web/System.Web/HttpServerUtility.cs index 0abb629c828..86c925de04b 100644 --- a/mcs/class/System.Web/System.Web/HttpServerUtility.cs +++ b/mcs/class/System.Web/System.Web/HttpServerUtility.cs @@ -192,19 +192,26 @@ namespace System.Web } else { query = ""; } - - string filePath = _Context.Request.MapPath (path); + + HttpRequest request = _Context.Request; HttpResponse response = _Context.Response; + + string oldQuery = request.QueryStringRaw; + request.QueryStringRaw = query; + + HttpValueCollection oldForm = null; + if (!preserveQuery) { + oldForm = _Context.Request.Form as HttpValueCollection; + _Context.Request.SetForm (new HttpValueCollection ()); + } + + string filePath = _Context.Request.MapPath (path); TextWriter output = writer; if (output == null) output = response.Output; - HttpRequest request = _Context.Request; string oldFilePath = request.FilePath; - request.SetFilePath (UrlUtils.Combine (_Context.Request.BaseVirtualDir, path)); - string oldQuery = request.QueryStringRaw; - - if (!preserveQuery) request.QueryStringRaw = query; + request.SetCurrentExePath (UrlUtils.Combine (_Context.Request.BaseVirtualDir, path)); IHttpHandler handler = _Context.ApplicationInstance.CreateHttpHandler (_Context, request.RequestType, path, @@ -221,9 +228,11 @@ namespace System.Web asyncHandler.EndProcessRequest (ar); } } finally { - request.SetFilePath (oldFilePath); + request.SetCurrentExePath (oldFilePath); request.QueryStringRaw = oldQuery; response.SetTextWriter (previous); + if (!preserveQuery) + _Context.Request.SetForm (oldForm); } } @@ -324,16 +333,7 @@ namespace System.Web /// they are cleared. The default is false. </param> public void Transfer (string path, bool preserveForm) { - HttpValueCollection oldForm = null; - if (!preserveForm) { - oldForm = _Context.Request.Form as HttpValueCollection; - _Context.Request.SetForm (new HttpValueCollection ()); - } - Execute (path, null, preserveForm); - if (!preserveForm) - _Context.Request.SetForm (oldForm); - _Context.Response.End (); } diff --git a/mcs/class/System.Web/System.Web/HttpUtility.cs b/mcs/class/System.Web/System.Web/HttpUtility.cs index d1a2d0dbb07..c7f3fecf63b 100644 --- a/mcs/class/System.Web/System.Web/HttpUtility.cs +++ b/mcs/class/System.Web/System.Web/HttpUtility.cs @@ -829,7 +829,7 @@ namespace System.Web { }
#if NET_1_1
- public string UrlPathEncode (string s)
+ public static string UrlPathEncode (string s)
{
if (s == null)
return null;
diff --git a/mcs/class/System.Web/System.Web/TimeoutManager.cs b/mcs/class/System.Web/System.Web/TimeoutManager.cs index d686568cc88..2fbdd35e3f6 100644 --- a/mcs/class/System.Web/System.Web/TimeoutManager.cs +++ b/mcs/class/System.Web/System.Web/TimeoutManager.cs @@ -106,7 +106,7 @@ namespace System.Web return; } - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; ArrayList clist = new ArrayList (); lock (this) { // The lock prevents Keys enumerator from being out of synch diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog index f8ba6ca28e1..bb78351e9de 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog @@ -1,3 +1,7 @@ +2004-10-04 Atsushi Enomoto <atsushi@ximian.com> + + * HtmlEmitter.cs : TH tag is not regarded as HTML tag. + This fixes bug #67390. Thu Sep 9 07:09:11 PDT 2004 Paolo Molaro <lupus@ximian.com> diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/HtmlEmitter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/HtmlEmitter.cs index 39839561219..ad5872c3c9a 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/HtmlEmitter.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl/HtmlEmitter.cs @@ -226,9 +226,8 @@ namespace Mono.Xml.Xsl case "SMALL": case "SPAN": case "STRIKE": case "STRONG": case "STYLE": case "SUB": case "SUP": case "TABLE": case "TBODY": case "TD": case "TEXTAREA": - case "TFOOT": case "THEAD": case "TITLE": case "TR": case "TT": - case "U": case "UL": - case "VAR": + case "TFOOT": case "TH": case "THEAD": case "TITLE": + case "TR": case "TT": case "U": case "UL": case "VAR": return true; } return false; diff --git a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog index ded7e921c04..0586af82013 100755 --- a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog +++ b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog @@ -1,3 +1,8 @@ +2004-09-28 Lluis Sanchez Gual <lluis@novell.com> + + * CodeIdentifier.cs: MakeValid now returns "Item" for an empty string. + This fixes bug #66877. + 2004-09-03 Lluis Sanchez Gual <lluis@novell.com> * XmlSerializer.cs: When the XmlReader is created by XmlSerializer, use diff --git a/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs b/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs index 93d78b2f69f..54c0b6bee87 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs @@ -55,7 +55,7 @@ namespace System.Xml.Serialization { if (identifier == null) throw new NullReferenceException (); if (identifier.Length == 0) - return identifier; + return "Item"; string output = ""; diff --git a/mcs/class/System/System.ComponentModel/AttributeCollection.cs b/mcs/class/System/System.ComponentModel/AttributeCollection.cs index 2c5c6d840e0..1221270f082 100644 --- a/mcs/class/System/System.ComponentModel/AttributeCollection.cs +++ b/mcs/class/System/System.ComponentModel/AttributeCollection.cs @@ -138,7 +138,7 @@ namespace System.ComponentModel get { Attribute attr = null; foreach (Attribute a in attrList) { - if (a.GetType () == type){ + if (type.IsAssignableFrom (a.GetType ())) { attr = a; break; } diff --git a/mcs/class/System/System.ComponentModel/ChangeLog b/mcs/class/System/System.ComponentModel/ChangeLog index 290fc659e98..13a43c1d05a 100644 --- a/mcs/class/System/System.ComponentModel/ChangeLog +++ b/mcs/class/System/System.ComponentModel/ChangeLog @@ -1,3 +1,8 @@ +2004-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AttributeCollection.cs: support attributes inherited from the one + we want. Fixes bug #67088. Thanks to Sander Rijken. + 2004-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TypeDescriptor.cs: when a component in componentTable is Disposed, diff --git a/mcs/class/System/System.IO/ChangeLog b/mcs/class/System/System.IO/ChangeLog index 9096cb03094..014914f20ca 100755 --- a/mcs/class/System/System.IO/ChangeLog +++ b/mcs/class/System/System.IO/ChangeLog @@ -1,3 +1,14 @@ +2004-10-07 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * DefaultWatcher.cs: if the file is removed between reading the + directory and filling the file info, catch the exception and ignore the + file. Fixes bug #59482. + +2004-10-07 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * DefaultWatcher.cs: don't use Directory.GetFileSystemEntries when the + pattern has no wildcards. Fixes bug #67447. + 2004-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> * FAMWatcher.cs: s/fam/libfam.so.0/ so that g_module finds it even diff --git a/mcs/class/System/System.IO/DefaultWatcher.cs b/mcs/class/System/System.IO/DefaultWatcher.cs index 36d6d939f4e..b68149c4ca3 100644 --- a/mcs/class/System/System.IO/DefaultWatcher.cs +++ b/mcs/class/System/System.IO/DefaultWatcher.cs @@ -37,9 +37,10 @@ namespace System.IO { class DefaultWatcherData { public FileSystemWatcher FSW; public string Directory; - public string FileMask; + public string FileMask; // If NoWildcards, contains the full path to the file. public bool IncludeSubdirs; public bool Enabled; + public bool NoWildcards; public DateTime DisabledTime; public Hashtable Files; } @@ -100,7 +101,12 @@ namespace System.IO { data.FSW = fsw; data.Directory = fsw.FullPath; - data.FileMask = fsw.MangledFilter; + data.NoWildcards = !fsw.Pattern.HasWildcard; + if (data.NoWildcards) + data.FileMask = Path.Combine (data.Directory, fsw.MangledFilter); + else + data.FileMask = fsw.MangledFilter; + data.IncludeSubdirs = fsw.IncludeSubdirectories; data.Enabled = true; data.DisabledTime = DateTime.MaxValue; @@ -185,6 +191,7 @@ namespace System.IO { } } + static string [] NoStringsArray = new string [0]; void DoFiles (DefaultWatcherData data, string directory, bool dispatch) { bool direxists = Directory.Exists (directory); @@ -194,10 +201,16 @@ namespace System.IO { } string [] files = null; - if (direxists) { + if (!direxists) { + files = NoStringsArray; + } else if (!data.NoWildcards) { files = Directory.GetFileSystemEntries (directory, data.FileMask); } else { - files = new string [0]; + // The pattern does not have wildcards + if (File.Exists (data.FileMask)) + files = new string [] { data.FileMask }; + else + files = NoStringsArray; } /* Set all as untested */ @@ -211,7 +224,14 @@ namespace System.IO { foreach (string filename in files) { FileData fd = (FileData) data.Files [filename]; if (fd == null) { - data.Files.Add (filename, CreateFileData (directory, filename)); + try { + data.Files.Add (filename, CreateFileData (directory, filename)); + } catch { + // The file might have been removed in the meanwhile + data.Files.Remove (filename); + continue; + } + if (dispatch) DispatchEvents (data.FSW, FileAction.Added, filename); } else if (fd.Directory == directory) { diff --git a/mcs/class/System/System.Net/ChangeLog b/mcs/class/System/System.Net/ChangeLog index 43d11edae2c..94166c8508a 100644 --- a/mcs/class/System/System.Net/ChangeLog +++ b/mcs/class/System/System.Net/ChangeLog @@ -1,3 +1,29 @@ +2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpWebRequest.cs: ProxyQuery returns true when we use a proxy without + tunneling a secure connection. + + * ServicePoint.cs: added UseConnect property. + + * ServicePointManager.cs: set the UseConnect property when we use a http + proxy for a https connection. + + * WebConnection.cs: setup the tunnled connection when using a proxy and + https. + +2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpWebRequest.cs: ProxyQuery returns true when we use a proxy without + tunneling a secure connection. + + * ServicePoint.cs: added UseConnect property. + + * ServicePointManager.cs: set the UseConnect property when we use a http + proxy for a https connection. + + * WebConnection.cs: setup the tunnled connection when using a proxy and + https. + 2004-09-13 Gonzalo Paniagua Javier <gonzalo@ximian.com> * HttpWebResponse.cs: remove unused SplitValue method. diff --git a/mcs/class/System/System.Net/HttpWebRequest.cs b/mcs/class/System/System.Net/HttpWebRequest.cs index f20a0747a3f..af18f9a6154 100644 --- a/mcs/class/System/System.Net/HttpWebRequest.cs +++ b/mcs/class/System/System.Net/HttpWebRequest.cs @@ -147,7 +147,7 @@ namespace System.Net get { return webHeaders ["Accept"]; } set { CheckRequestStarted (); - webHeaders.SetInternal ("Accept", value); + webHeaders.RemoveAndAdd ("Accept", value); } } @@ -199,7 +199,7 @@ namespace System.Net if (keepAlive && val.IndexOf ("keep-alive") == -1) value = value + ", Keep-Alive"; - webHeaders.SetInternal ("Connection", value); + webHeaders.RemoveAndAdd ("Connection", value); } } @@ -231,7 +231,7 @@ namespace System.Net webHeaders.RemoveInternal ("Content-Type"); return; } - webHeaders.SetInternal ("Content-Type", value); + webHeaders.RemoveAndAdd ("Content-Type", value); } } @@ -266,7 +266,7 @@ namespace System.Net if (val == "100-continue") throw new ArgumentException ("100-Continue cannot be set with this property.", "value"); - webHeaders.SetInternal ("Expect", value); + webHeaders.RemoveAndAdd ("Expect", value); } } @@ -452,7 +452,7 @@ namespace System.Net if (!sendChunked) throw new ArgumentException ("SendChunked must be True", "value"); - webHeaders.SetInternal ("Transfer-Encoding", value); + webHeaders.RemoveAndAdd ("Transfer-Encoding", value); } } @@ -484,7 +484,7 @@ namespace System.Net } internal bool ProxyQuery { - get { return servicePoint.UsesProxy; } + get { return servicePoint.UsesProxy && !servicePoint.UseConnect; } } // Methods @@ -852,13 +852,13 @@ namespace System.Net webHeaders.RemoveInternal ("Transfer-Encoding"); } else if (sendChunked) { continue100 = true; - webHeaders.SetInternal ("Transfer-Encoding", "chunked"); + webHeaders.RemoveAndAdd ("Transfer-Encoding", "chunked"); webHeaders.RemoveInternal ("Content-Length"); } if (actualVersion == HttpVersion.Version11 && continue100 && servicePoint.SendContinue) { // RFC2616 8.2.3 - webHeaders.SetInternal ("Expect" , "100-continue"); + webHeaders.RemoveAndAdd ("Expect" , "100-continue"); expectContinue = true; } else { webHeaders.RemoveInternal ("Expect"); @@ -871,9 +871,9 @@ namespace System.Net servicePoint.ProtocolVersion == HttpVersion.Version10); if (keepAlive && (version == HttpVersion.Version10 || spoint10)) { - webHeaders.SetInternal (connectionHeader, "keep-alive"); + webHeaders.RemoveAndAdd (connectionHeader, "keep-alive"); } else if (!keepAlive && version == HttpVersion.Version11) { - webHeaders.SetInternal (connectionHeader, "close"); + webHeaders.RemoveAndAdd (connectionHeader, "close"); } webHeaders.SetInternal ("Host", actualUri.Authority); @@ -883,9 +883,9 @@ namespace System.Net webHeaders.SetInternal ("Cookie", cookieHeader); } - if (!usedPreAuth && preAuthenticate) { + if (!usedPreAuth && preAuthenticate) DoPreAuthenticate (); - } + return webHeaders.ToString (); } diff --git a/mcs/class/System/System.Net/ServicePoint.cs b/mcs/class/System/System.Net/ServicePoint.cs index a22ca44aefd..09a1f61d609 100644 --- a/mcs/class/System/System.Net/ServicePoint.cs +++ b/mcs/class/System/System.Net/ServicePoint.cs @@ -52,6 +52,7 @@ namespace System.Net bool usesProxy; Hashtable groups; bool sendContinue = true; + bool useConnect; #if NET_1_1 bool useNagle; #endif @@ -160,6 +161,11 @@ namespace System.Net set { usesProxy = value; } } + internal bool UseConnect { + get { return useConnect; } + set { useConnect = value; } + } + internal bool AvailableForRecycling { get { return CurrentConnections == 0 diff --git a/mcs/class/System/System.Net/ServicePointManager.cs b/mcs/class/System/System.Net/ServicePointManager.cs index ca176694532..06a7284777e 100644 --- a/mcs/class/System/System.Net/ServicePointManager.cs +++ b/mcs/class/System/System.Net/ServicePointManager.cs @@ -186,11 +186,16 @@ namespace System.Net RecycleServicePoints (); bool usesProxy = false; + bool useConnect = false; if (proxy != null && !proxy.IsBypassed(address)) { usesProxy = true; + bool isSecure = address.Scheme == "https"; address = proxy.GetProxy (address); - if (address.Scheme != "http" && address.Scheme != "https") + if (address.Scheme != "http" && !isSecure) throw new NotSupportedException ("Proxy scheme not supported."); + + if (isSecure && address.Scheme == "http") + useConnect = true; } address = new Uri (address.Scheme + "://" + address.Authority); @@ -212,6 +217,7 @@ namespace System.Net sp.UseNagleAlgorithm = useNagle; #endif sp.UsesProxy = usesProxy; + sp.UseConnect = useConnect; servicePoints.Add (address, sp); } diff --git a/mcs/class/System/System.Net/WebConnection.cs b/mcs/class/System/System.Net/WebConnection.cs index f3ef1d22076..0f72d361996 100644 --- a/mcs/class/System/System.Net/WebConnection.cs +++ b/mcs/class/System/System.Net/WebConnection.cs @@ -148,6 +148,70 @@ namespace System.Net } } + bool CreateTunnel (HttpWebRequest request, Stream stream, out byte [] buffer) + { + StringBuilder sb = new StringBuilder (); + sb.Append ("CONNECT "); + sb.Append (request.Address.Host); + sb.Append (':'); + sb.Append (request.Address.Port); + sb.Append (" HTTP/"); + if (request.ServicePoint.ProtocolVersion == HttpVersion.Version11) + sb.Append ("1.1"); + else + sb.Append ("1.0"); + + sb.Append ("\r\nHost: "); + sb.Append (request.Address.Authority); + if (request.Headers ["Proxy-Authorization"] != null) { + sb.Append ("\r\nProxy-Authorization: "); + sb.Append (request.Headers ["Proxy-Authorization"]); + } + + sb.Append ("\r\n\r\n"); + byte [] connectBytes = Encoding.Default.GetBytes (sb.ToString ()); + stream.Write (connectBytes, 0, connectBytes.Length); + return ReadHeaders (request, stream, out buffer); + } + + bool ReadHeaders (HttpWebRequest request, Stream stream, out byte [] retBuffer) + { + retBuffer = null; + + byte [] buffer = new byte [256]; + MemoryStream ms = new MemoryStream (); + bool gotStatus = false; + + while (true) { + int n = stream.Read (buffer, 0, 256); + ms.Write (buffer, 0, n); + int start = 0; + string str = null; + while (ReadLine (ms.GetBuffer (), ref start, (int) ms.Length, ref str)) { + if (str == null) { + if (ms.Length - start > 0) { + retBuffer = new byte [ms.Length - start]; + Buffer.BlockCopy (ms.GetBuffer (), start, retBuffer, 0, retBuffer.Length); + } + return true; + } + + if (gotStatus) + continue; + + int spaceidx = str.IndexOf (' '); + if (spaceidx == -1) + throw new Exception (); + + int resultCode = Int32.Parse (str.Substring (spaceidx + 1, 3)); + if (resultCode != 200) + throw new Exception (); + + gotStatus = true; + } + } + } + bool CreateStream (HttpWebRequest request) { try { @@ -156,9 +220,16 @@ namespace System.Net ssl = true; EnsureSSLStreamAvailable (); if (!reused || nstream == null || nstream.GetType () != sslStream) { - object[] args = new object [3] { serverStream, + byte [] buffer = null; + if (sPoint.UseConnect) { + bool ok = CreateTunnel (request, serverStream, out buffer); + if (!ok) + return false; + } + + object[] args = new object [4] { serverStream, request.ClientCertificates, - request }; + request, buffer}; nstream = (Stream) Activator.CreateInstance (sslStream, args); } // we also need to set ServicePoint.Certificate diff --git a/mcs/class/System/System.Net/WebHeaderCollection.cs b/mcs/class/System/System.Net/WebHeaderCollection.cs index f41105bd5bc..4d3c29db3cd 100644 --- a/mcs/class/System/System.Net/WebHeaderCollection.cs +++ b/mcs/class/System/System.Net/WebHeaderCollection.cs @@ -267,7 +267,18 @@ namespace System.Net base.Set (name, value);
} }
-
+ + internal void RemoveAndAdd (string name, string value) + { + if (value == null) + value = String.Empty; + else + value = value.Trim (); + + base.Remove (name); + base.Set (name, value); + } + internal void RemoveInternal (string name)
{
if (name == null)
diff --git a/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog b/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog index 4162be45b05..1515435dce9 100644 --- a/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog +++ b/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog @@ -1,3 +1,8 @@ +2004-09-29 Sebastien Pouliot <sebastien@ximian.com> + + * RSAManaged.cs: KeySize is now always a multiple of 8 bits. + Fix #66929. + 2004-06-23 Sebastien Pouliot <sebastien@ximian.com> * SymmetricTransform.cs: Reduce by one the number of block when diff --git a/mcs/class/corlib/Mono.Security.Cryptography/RSAManaged.cs b/mcs/class/corlib/Mono.Security.Cryptography/RSAManaged.cs index 40f58801dce..82b16f6b291 100644 --- a/mcs/class/corlib/Mono.Security.Cryptography/RSAManaged.cs +++ b/mcs/class/corlib/Mono.Security.Cryptography/RSAManaged.cs @@ -149,8 +149,12 @@ namespace Mono.Security.Cryptography { public override int KeySize { get { // in case keypair hasn't been (yet) generated - if (keypairGenerated) - return n.BitCount (); + if (keypairGenerated) { + int ks = n.BitCount (); + if ((ks & 7) != 0) + ks = ks + (8 - (ks & 7)); + return ks; + } else return base.KeySize; } diff --git a/mcs/class/corlib/System.Reflection.Emit/ChangeLog b/mcs/class/corlib/System.Reflection.Emit/ChangeLog index 862d7d19c06..0ecc28b55ff 100644 --- a/mcs/class/corlib/System.Reflection.Emit/ChangeLog +++ b/mcs/class/corlib/System.Reflection.Emit/ChangeLog @@ -1,3 +1,13 @@ +2004-10-06 Zoltan Varga <vargaz@freemail.hu> + + * ModuleBuilder.cs (GetTypes): Fix length of returned array. Fixes + #65931. + +2004-10-04 Zoltan Varga <vargaz@freemail.hu> + + * ModuleBuilder.cs (DefineType): Check for duplicate type names. Fixes + #65988. + 2004-09-17 Zoltan Varga <vargaz@freemail.hu> * CustomAttributeBuilder.cs: Applied patch from Marcus Urban (mathpup@mylinuxisp.com). Add support for defining custom marshallers by calling SetCustomAttribute. diff --git a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs index eb958b22b7f..eabb8f84fb9 100644 --- a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs @@ -252,6 +252,8 @@ namespace System.Reflection.Emit { } private TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, Type[] interfaces, PackingSize packsize, int typesize) { + if (name_cache.Contains (name)) + throw new ArgumentException ("Duplicate type name within an assembly."); TypeBuilder res = new TypeBuilder (this, name, attr, parent, interfaces, packsize, typesize, null); if (types != null) { if (types.Length == num_types) { @@ -433,7 +435,7 @@ namespace System.Reflection.Emit { if (types == null) return new TypeBuilder [0]; - int n = types.Length; + int n = num_types; TypeBuilder [] copy = new TypeBuilder [n]; Array.Copy (types, copy, n); diff --git a/mcs/class/corlib/System.Security.Permissions/ChangeLog b/mcs/class/corlib/System.Security.Permissions/ChangeLog index 219a8c199ea..63e95738285 100644 --- a/mcs/class/corlib/System.Security.Permissions/ChangeLog +++ b/mcs/class/corlib/System.Security.Permissions/ChangeLog @@ -1,3 +1,9 @@ +2004-10-05 Sebastien Pouliot <sebastien@ximian.com> + + * PrincipalPermission.cs: Fixed bug where a change to a permission + (e.g. Copy, Union) could affect multiple instances. Fixed FromXml + to clear existing entries. + 2004-06-10 Gert Driesen <drieseng@users.sourceforge.net> * StrongNameIdentityPermission.cs: removed extra useless finalizer diff --git a/mcs/class/corlib/System.Security.Permissions/PrincipalPermission.cs b/mcs/class/corlib/System.Security.Permissions/PrincipalPermission.cs index d1f23c091a5..17235490015 100644 --- a/mcs/class/corlib/System.Security.Permissions/PrincipalPermission.cs +++ b/mcs/class/corlib/System.Security.Permissions/PrincipalPermission.cs @@ -98,7 +98,7 @@ namespace System.Security.Permissions { internal PrincipalPermission (ArrayList principals) { - this.principals = principals; + this.principals = (ArrayList) principals.Clone (); } // Properties @@ -147,6 +147,7 @@ namespace System.Security.Permissions { if ((esd.Attributes ["version"] as string) != "1") throw new ArgumentException ("wrong version"); + principals.Clear (); // Children is null, not empty, when no child is present if (esd.Children != null) { foreach (SecurityElement se in esd.Children) { @@ -273,7 +274,7 @@ namespace System.Security.Permissions { PrincipalPermission union = new PrincipalPermission (principals); foreach (PrincipalInfo pi in o.principals) - principals.Add (pi); + union.principals.Add (pi); return union; } @@ -284,4 +285,4 @@ namespace System.Security.Permissions { return 8; } } -}
\ No newline at end of file +} diff --git a/mcs/class/corlib/System/AppDomain.cs b/mcs/class/corlib/System/AppDomain.cs index 06ab7351c93..e987f1a7b4f 100755 --- a/mcs/class/corlib/System/AppDomain.cs +++ b/mcs/class/corlib/System/AppDomain.cs @@ -63,10 +63,10 @@ namespace System static string _process_guid; [ThreadStatic] - Hashtable type_resolve_in_progress; + static Hashtable type_resolve_in_progress; [ThreadStatic] - Hashtable assembly_resolve_in_progress; + static Hashtable assembly_resolve_in_progress; // Evidence evidence; diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog index bc96feca47d..f9b59c29d4f 100644 --- a/mcs/class/corlib/System/ChangeLog +++ b/mcs/class/corlib/System/ChangeLog @@ -1,3 +1,32 @@ +2004-10-08 Zoltan Varga <vargaz@freemail.hu> + + * Convert.cs (ToType): Throw an exception when converting null to a + valuetype. Fixes #67780. + +2004-10-08 Atsushi Enomoto <atsushi@ximian.com> + + * DateTime.cs : Removed incorrectly injected HEAD fix. + +2004-10-08 Atsushi Enomoto <atsushi@ximian.com> + + * DateTime.cs : When it it not exact parse, 'Z' is allowed as a suffix + of m/s/t/z. This fixes bug 66723. + +2004-10-04 Zoltan Varga <vargaz@freemail.hu> + + * AppDomain.cs: Make ThreadStatic variables static. Fixes #56614. + +2004-09-30 Geoff Norton <gnorton@customerdna.com> + + * Convert.cs: ConvertToBase* was not endian aware. Implemented EndianSwap + and swapping of all values before going into the BitConverter so that values + are returned with proper endianess. + +2004-09-23 Martin Garton <martin@wrasse.demon.co.uk> + + * Convert.cs: ToType was returning unconverted object when it should + fail with an ArgumentException. + 2004-09-19 Dick Porter <dick@ximian.com> * Console.cs: Use the internal wrappers for StreamReader and diff --git a/mcs/class/corlib/System/Convert.cs b/mcs/class/corlib/System/Convert.cs index f63481831c5..5e15d578704 100644 --- a/mcs/class/corlib/System/Convert.cs +++ b/mcs/class/corlib/System/Convert.cs @@ -2559,8 +2559,18 @@ namespace System { return (long) result;
}
+ private static void EndianSwap (ref byte[] value) + { + byte[] buf = new byte[value.Length]; + for (int i = 0; i < value.Length; i++) + buf[i] = value[value.Length-1-i]; + value = buf; + } + private static string ConvertToBase2 (byte[] value) { + if (!BitConverter.IsLittleEndian) + EndianSwap (ref value); StringBuilder sb = new StringBuilder (); for (int i = value.Length - 1; i >= 0; i--) { byte b = value [i]; @@ -2580,6 +2590,8 @@ namespace System { private static string ConvertToBase8 (byte[] value)
{ + if (!BitConverter.IsLittleEndian) + EndianSwap (ref value); ulong l = 0; switch (value.Length) { case 1: @@ -2612,6 +2624,8 @@ namespace System { private static string ConvertToBase16 (byte[] value) { + if (!BitConverter.IsLittleEndian) + EndianSwap (ref value); StringBuilder sb = new StringBuilder (); for (int i = value.Length - 1; i >= 0; i--) { char high = (char)((value[i] >> 4) & 0x0f); @@ -2672,8 +2686,12 @@ namespace System { internal static object ToType (object value, Type conversionType,
IFormatProvider provider)
{
- if (value == null)
- return null;
+ if (value == null) { + if ((conversionType != null) && conversionType.IsValueType) + throw new InvalidCastException ("Null object can not be converted to a value type."); + else + return null; + } if (conversionType == null)
throw new InvalidCastException ("Cannot cast to destination type.");
@@ -2739,12 +2757,7 @@ namespace System { else if (conversionType == conversionTable[18]) // 18 TypeCode.String
return (object) convertValue.ToString (provider);
else {
- try {
- return (object) convertValue;
- }
- catch {
- throw new ArgumentException (Locale.GetText ("Unknown target conversion type"));
- }
+ throw new ArgumentException (Locale.GetText ("Unknown target conversion type"));
}
} else
// Not in the conversion table
diff --git a/mcs/class/corlib/System/DateTime.cs b/mcs/class/corlib/System/DateTime.cs index ca1e1e564f7..188d0d27bd4 100644 --- a/mcs/class/corlib/System/DateTime.cs +++ b/mcs/class/corlib/System/DateTime.cs @@ -1190,6 +1190,22 @@ namespace System s = s.Substring (num_parsed); + if (!exact) { + switch (chars [pos]) { + case 'm': + case 's': + case 'f': + case 'z': + if (s.Length > 0 && s [0] == 'Z' + && (pos + 1 == chars.Length + || chars [pos + 1] != 'Z')) { + useutc = true; + s = s.Substring (1); + } + break; + } + } + pos = pos + num + 1; num = 0; } diff --git a/mcs/class/corlib/Test/System/ChangeLog b/mcs/class/corlib/Test/System/ChangeLog index 1e1e1931fbe..6d419bfee33 100644 --- a/mcs/class/corlib/Test/System/ChangeLog +++ b/mcs/class/corlib/Test/System/ChangeLog @@ -1,3 +1,8 @@ +2004-09-23 Martin Garton <martin@wrasse.demon.co.uk> + + * ConvertTest.cs: Ensure ToType() fails with an ArgumentException in + a case where is cannot convert. + 2004-08-17 Sebastien Pouliot <sebastien@ximian.com> * VersionTest.cs: Added tests when cloning a version with no build and diff --git a/mcs/class/corlib/Test/System/ConvertTest.cs b/mcs/class/corlib/Test/System/ConvertTest.cs index bafdffdb566..44e5f547567 100755 --- a/mcs/class/corlib/Test/System/ConvertTest.cs +++ b/mcs/class/corlib/Test/System/ConvertTest.cs @@ -189,7 +189,17 @@ namespace MonoTests.System { } catch (Exception e) { AssertEquals("#A33", typeof(ArgumentNullException), e.GetType()); - } + } + + try { + /* should fail to convert string to any enumeration type. */ + Convert.ChangeType("random string", typeof(DayOfWeek)); + Fail(); + } + catch (Exception e) { + AssertEquals("#A34", typeof(ArgumentException), e.GetType()); + } + } public void TestGetTypeCode() { |