Summary: | SimpleDateFormat fails to parse valid dates | ||
---|---|---|---|
Product: | gcc | Reporter: | Charles Duffy <cduffy> |
Component: | libgcj | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | gcc-bugs, java-prs, tromey |
Priority: | P2 | ||
Version: | 3.3 | ||
Target Milestone: | 4.0.0 | ||
Host: | i686-pc-linux-gnu | Target: | i686-pc-linux-gnu |
Build: | i686-pc-linux-gnu | Known to work: | |
Known to fail: | Last reconfirmed: | 2003-12-17 06:04:29 |
Description
Charles Duffy
2003-06-04 05:24:49 UTC
Confirmed with 3.3.1 (20030526) and the mainline (20030604). I looked at this today. I've fixed a couple bugs in this area. I'll check in the patch soon. The bigger problem is that our SimpleDateFormat doesn't understand the "Z" format. I'm leaving this part unfixed for now. Tom, did the patch you checked in at http://gcc.gnu.org/ml/gcc-cvs/2003-06/msg00347.html fix this problem? Thanks, Dara It still fails on the mainline (20030724). In current Classpath CVS head, parsing of this string is now successful. The output of the given test case is: $ java TestParse Result: Wed Jun 04 03:09:35 2003 Fail "Fail" is printed because the value doesn't match the given string. But, this string is the time localized to the timezone of where the class is being run. Sun outputs this localized String, while, at present, the Classpath one is always in GMT. It is clear that the above figure is the time 22:09:35 -0500 shifted five hours forward to GMT. Sun's VM (1.5) also fails the second bit, as it produces the localized output "Wed Jun 04 04:09:35 BST 2003" (being run on a machine in the UK). Comparing the numeric millisecond values is more accurate, and this shows equivalent values (1054696175000) for both VMs, and a mental grasp of the date/time shows that the output is correct. The only possible bug remaining here is that the Date.toString() output is incorrect, as it does not use the timezone field. Whether this is truly a bug or not is open to debate, as there appears to be no documentation on this in java.util.Date other than the requirement for a zzz field. Subject: Bug 11085 CVSROOT: /cvs/gcc Module name: gcc Changes by: tromey@gcc.gnu.org 2005-03-23 21:26:00 Modified files: libjava : ChangeLog libjava/java/text: SimpleDateFormat.java libjava/java/util: Calendar.java GregorianCalendar.java Log message: 2005-03-23 Sven de Marothy <sven@physto.se> PR libgcj/2641, PR libgcj/9854, PR libgcj/14892, PR libgcj/18083, PR libgcj/11085: * java/util/Calendar.java (set): Use starting day of week when one is needed if none is given. * java/text/SimpleDateFormat.java (parse): Handle 1-12 and 1-24 timestamps correctly. * java/util/GregorianCalendar.java (computeTime, computeFields): HOUR should be in 0-11 format. (nonLeniencyCheck): Adjust leniency checking to that fact. (getLinearDay): Should be private. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3431&r2=1.3432 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/text/SimpleDateFormat.java.diff?cvsroot=gcc&r1=1.32&r2=1.33 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/util/Calendar.java.diff?cvsroot=gcc&r1=1.27&r2=1.28 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/util/GregorianCalendar.java.diff?cvsroot=gcc&r1=1.26&r2=1.27 Subject: Bug 11085 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: tromey@gcc.gnu.org 2005-03-23 21:36:25 Modified files: libjava : ChangeLog libjava/java/util: Calendar.java GregorianCalendar.java libjava/java/text: SimpleDateFormat.java Log message: 2005-03-23 Sven de Marothy <sven@physto.se> PR libgcj/2641, PR libgcj/9854, PR libgcj/14892, PR libgcj/18083, PR libgcj/11085: * java/util/Calendar.java (set): Use starting day of week when one is needed if none is given. * java/text/SimpleDateFormat.java (parse): Handle 1-12 and 1-24 timestamps correctly. * java/util/GregorianCalendar.java (computeTime, computeFields): HOUR should be in 0-11 format. (nonLeniencyCheck): Adjust leniency checking to that fact. (getLinearDay): Should be private. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.3391.2.22&r2=1.3391.2.23 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/util/Calendar.java.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.27&r2=1.27.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/util/GregorianCalendar.java.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.26&r2=1.26.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/text/SimpleDateFormat.java.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.32&r2=1.32.2.1 Fix checked in. |