Author: atsushi
Date: 2005-05-24 15:17:54 -0400 (Tue, 24 May 2005)
New Revision: 44938

Modified:
   trunk/mcs/class/corlib/System/ChangeLog
   trunk/mcs/class/corlib/System/DateTime.cs
   trunk/mcs/class/corlib/Test/System/ChangeLog
   trunk/mcs/class/corlib/Test/System/DateTimeTest.cs
Log:
2005-05-24  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * DateTime.cs : Allow ',' where whitespaces are allowed.
          Fixed bug #71289.

        * DateTimeTest.cs : testcase for #71289.



Modified: trunk/mcs/class/corlib/System/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System/ChangeLog     2005-05-24 18:11:33 UTC (rev 
44937)
+++ trunk/mcs/class/corlib/System/ChangeLog     2005-05-24 19:17:54 UTC (rev 
44938)
@@ -1,3 +1,8 @@
+2005-05-24  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * DateTime.cs : Allow ',' where whitespaces are allowed.
+         Fixed bug #71289.
+
 2005-05-22  Ben Maurer  <[EMAIL PROTECTED]>
 
        * BitConverter.cs: Speed this up, fixing 74014. Patch from

Modified: trunk/mcs/class/corlib/System/DateTime.cs
===================================================================
--- trunk/mcs/class/corlib/System/DateTime.cs   2005-05-24 18:11:33 UTC (rev 
44937)
+++ trunk/mcs/class/corlib/System/DateTime.cs   2005-05-24 19:17:54 UTC (rev 
44938)
@@ -914,24 +914,33 @@
                                } else if (chars[pos] == '%') {
                                        pos++;
                                        continue;
-                               } else if (Char.IsWhiteSpace (s [valuePos])) {
+                               } else if (Char.IsWhiteSpace (s [valuePos]) ||
+                                       s [valuePos] == ',' && 
Char.IsWhiteSpace (chars [pos])) {
                                        valuePos++;
-
-                                       if (Char.IsWhiteSpace (chars[pos])) {
+                                       if (exact && (style & 
DateTimeStyles.AllowInnerWhite) == 0) {
+                                               if (!Char.IsWhiteSpace 
(chars[pos]))
+                                                       return false;
                                                pos++;
                                                continue;
                                        }
 
-                                       if (exact && (style & 
DateTimeStyles.AllowInnerWhite) == 0)
-                                               return false;
                                        int ws = valuePos;
                                        while (ws < s.Length) {
-                                               if (Char.IsWhiteSpace (s [ws]))
+                                               if (Char.IsWhiteSpace (s [ws]) 
|| s [ws] == ',')
                                                        ws++;
                                                else
                                                        break;
                                        }
                                        valuePos = ws;
+                                       ws = pos;
+                                       while (ws < chars.Length) {
+                                               if (Char.IsWhiteSpace (chars 
[ws]) || chars [ws] == ',')
+                                                       ws++;
+                                               else
+                                                       break;
+                                       }
+                                       pos = ws;
+                                       continue;
                                }
 
 

Modified: trunk/mcs/class/corlib/Test/System/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System/ChangeLog        2005-05-24 18:11:33 UTC 
(rev 44937)
+++ trunk/mcs/class/corlib/Test/System/ChangeLog        2005-05-24 19:17:54 UTC 
(rev 44938)
@@ -1,3 +1,7 @@
+2005-05-24  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * DateTimeTest.cs : testcase for #71289.
+
 2005-05-21  Ben Maurer  <[EMAIL PROTECTED]>
 
        * StringTest.cs: Add a test for bug #62160

Modified: trunk/mcs/class/corlib/Test/System/DateTimeTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System/DateTimeTest.cs  2005-05-24 18:11:33 UTC 
(rev 44937)
+++ trunk/mcs/class/corlib/Test/System/DateTimeTest.cs  2005-05-24 19:17:54 UTC 
(rev 44938)
@@ -717,6 +717,26 @@
        }
 
        [Test]
+       // bug #71289
+       public void TestParse5 ()
+       {
+               DateTime.Parse ("Sat,,,,,, 01 Oct 1994 03:00:00",
+                       CultureInfo.InvariantCulture);
+               // more example...
+               DateTime.Parse ("Sat,,, 01,,, Oct,,, ,,,1994 03:00:00",
+                       CultureInfo.InvariantCulture);
+#if NET_2_0
+               try {
+                       // ',' after 03 is not allowed.
+                       DateTime.Parse ("Sat,,, 01,,, Oct,,, ,,,1994 03,:00:00",
+                       CultureInfo.InvariantCulture);
+                       Fail ("Should fail here.");
+               } catch (FormatException) {
+               }
+#endif
+       }
+
+       [Test]
        [ExpectedException(typeof (FormatException))]
        public void ParseFormatException1 ()
        {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to