[Mono-bugs] [Bug 41845][Nor] Changed - Converting date string with large year doesn't throw correct exception
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sat, 29 Nov 2003 07:42:04 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by banirban@novell.com.
http://bugzilla.ximian.com/show_bug.cgi?id=41845
--- shadow/41845 2003-11-13 12:24:03.000000000 -0500
+++ shadow/41845.tmp.22722 2003-11-29 07:42:04.000000000 -0500
@@ -1,13 +1,13 @@
Bug#: 41845
Product: Mono/Class Libraries
Version: unspecified
OS: All
OS Details:
-Status: NEW
-Resolution:
+Status: RESOLVED
+Resolution: FIXED
Severity: Unknown
Priority: Normal
Component: CORLIB
AssignedTo: banirban@novell.com
ReportedBy: ndrochak@gol.com
QAContact: mono-bugs@ximian.com
@@ -39,6 +39,56 @@
When you assign a bug to yourself, please use the Reassign bug to
____ option and enter your bugzilla username. The Change status to
Assigned is confusing, and does not work right.
-- Ben
+
+------- Additional Comments From banirban@novell.com 2003-11-29 07:42 -------
+===================================================================
+RCS file: /mono/mcs/class/corlib/System/DateTime.cs,v
+retrieving revision 1.40
+diff -u -r1.40 DateTime.cs
+@@ -729,20 +730,24 @@
+ num = 3;
+
+ }
+
+ break;
+
+ case 'y':
+ if (year != -1)
+
+ return false;
+
+
+
+ if (num == 0) {
+ year = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+
+ year += (year < 30) ? 2000 : 1900;
+
+ } else if (num < 3) {
+ year = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+
+ year += (year < 30) ? 2000 : 1900;
+
++ } else {
++ if(Char.IsDigit(s[4]))
++ throw new ArgumentOutOfRangeException ("year", "Valid " +
+"values are between 1 and 9999 inclusive");
+
+ year = _ParseNumber (s, 4, false, sloppy_parsing, out num_parsed);
+
+ num = 3;
+
+- }
+
++ }
++
+ // if there is another digit next to the ones we just parsed,
+then the year value
+
+ // is too big for sure.
+
+ //if (num_parsed < s.Length && Char.IsDigit(s[num_parsed]) ||
+(year != 0 && (year < 1 || year > 9999)))