bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/30359] SimpleDateFormat parse "invalid Date syntax in" ex


From: colin dot green at focus-solutions dot co dot uk
Subject: [Bug classpath/30359] SimpleDateFormat parse "invalid Date syntax in" exception
Date: 23 Mar 2007 12:07:43 -0000


------- Comment #5 from colin dot green at focus-solutions dot co dot uk  
2007-03-23 12:07 -------
I haven't tested this against the latest from CVS but I would like to report a
problem parsing a date on the last day of the year.

Here's some sample code to demonstrate the problem (in C# using IKVM, I'll give
version numbers later):


----------------------------------------------
        SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
        df.setLenient(false);
        for(int i=1970; i<2010; i++) {
                 ParsePosition pp = new ParsePosition(0);

                 try {
                          Date date = df.parse("31/12/" + i.ToString(), pp);
                          Debug.WriteLine("date=" + date.toLocaleString());
                 }
                 catch(System.Exception ex)
                 {}
        }
----------------------------------------------

The date pattern shown here is the same as the standard SHORT pattern for the
en-GB (UK) locale. 

With IKVM 0.32/Classpath 0.93 this code fails to parse any of the dates, with
the lenient flag set either way.

With IKVM 0.3/Classpath 0.92 and setLenient(true) all of the dates parse OK.
But with setLenient(false) the following dates fail with a
NullReferenceException:

31/12/1971
31/12/1972
31/12/1976
31/12/1977
31/12/1982
31/12/1983
31/12/1988
31/12/1993
31/12/1994
31/12/1999
31/12/2000
31/12/2004
31/12/2005


-- 

colin dot green at focus-solutions dot co dot uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |colin dot green at focus-
                   |                            |solutions dot co dot uk


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30359





reply via email to

[Prev in Thread] Current Thread [Next in Thread]