[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
Sun, 25 Apr 2004 10:33:38 -0400 (EDT)


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 ndrochak@gol.com.

http://bugzilla.ximian.com/show_bug.cgi?id=41845

--- shadow/41845	2003-06-23 11:31:55.000000000 -0400
+++ shadow/41845.tmp.20982	2004-04-25 10:33:38.000000000 -0400
@@ -1,17 +1,17 @@
 Bug#: 41845
-Product: Mono/Class Libraries
+Product: Mono: Class Libraries
 Version: unspecified
 OS: All
 OS Details: 
-Status: NEW   
+Status: REOPENED   
 Resolution: 
 Severity: Unknown
 Priority: Normal
 Component: CORLIB
-AssignedTo: mono-bugs@ximian.com                            
+AssignedTo: banirban@novell.com                            
 ReportedBy: ndrochak@gol.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
 Summary: Converting date string with large year doesn't throw correct exception
 
@@ -28,6 +28,71 @@
 
 ------- Additional Comments From bmaurer@users.sf.net  2003-05-11 21:09 -------
 Ok, this looks like it is causing #G22 in ToDateTimeTest to fail.
 
 ------- Additional Comments From bmaurer@users.sf.net  2003-06-23 11:31 -------
 *** Bug 45286 has been marked as a duplicate of this bug. ***
+
+------- Additional Comments From bmaurer@users.sf.net  2003-11-13 12:24 -------
+Hello, Anirban
+
+I see you are new to the Mono team, Welcome!
+
+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)))
+
+------- Additional Comments From ndrochak@gol.com  2004-04-25 10:33 -------
+Unit tests are showing this throwing a FormatException instead of the
+correct one: ArgumentOutOfRangeException