SimpleDateFormat throws exception with valid inputs - ideas?

Scott Gilbertson scottg@mantatest.com
Thu May 15 21:41:00 GMT 2003


The attached program runs OK on the JRE but generates an exception on GCJ
(trunk cvs fetch from a few weeks ago).  I started to look through
SimpleDateFormat to see if I could spot what was happening, but I'm not at
all familiar with that class.  Does anybody have an idea of what's going on,
or some tips to debug it?  Thanks.

In the output below, you'll see a pair of numbers following each
FieldSizePair.  I added that to FieldSizePair.toString for debugging, to see
if any of the tokens were invalid.  They look OK to me.  I'm not getting
line numbers in the stack trace for some reason.

Here Is the result of a GCJ run:
[root@mts5000dev1 javaTests]# gcj -C TestSimpleDateFormat.java
[root@mts5000dev1 javaTests]# gij -DCLASSPATH=. TestSimpleDateFormat
ERROR: this date parser threw an exception:

java.text.SimpleDateFormat$FieldSizePair@81040d0(2,2)/java.text.SimpleDateFo
rmat$FieldSizePair@81040c0(3,2)/java.text.SimpleDateFormat$FieldSizePair@810
40b0(1,4)
java.text.SimpleDateFormat$FieldSizePair@81040a0(5,1):java.text.SimpleDateFo
rmat$FieldSizePair@8104090(6,1):java.text.SimpleDateFormat$FieldSizePair@810
4080(7,1).java.text.SimpleDateFormat$FieldSizePair@8104070(8,3)
 Index = 23
java.text.ParseException: invalid Date syntax
   at java.text.DateFormat.parse(java.lang.String)
(/usr/lib/libgcj.so.4.0.0)
   at TestSimpleDateFormat.main(java.lang.String[]) (Unknown Source)

Here is the result of a Sun JRE run:
[root@mts5000dev1 javaTests]# /usr/local/s1studio_jdk/j2sdk1.4.1/bin/java
TestSimpleDateFormat
Date parsed: value = Fri May 24 14:30:53 EDT 2002
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestSimpleDateFormat.java
Type: application/octet-stream
Size: 932 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20030515/913deb47/attachment.obj>


More information about the Java mailing list