SimpleDateFormat parse bug: doesn't like embedded spaces
Scott Gilbertson
scottg@mantatest.com
Fri Feb 3 22:21:00 GMT 2006
I found a difference between SimpleDateFormat.parse in GCJ/Classpath vs.
Sun. Tiny test program attached.
The attached program runs the following strings:
"2:03:34"
"2: 3:34"
Through this SimpleDateFormat:
new SimpleDateFormat ("H':'m':'s")
The result with GCJ (from svn a Jan 24) is different from Sun JRE 1.4.2_08
Sun:
Parsing "2:03:34"
- Result = Thu Jan 01 02:03:34 EST 1970
Parsing "2: 3:34"
- Result = Thu Jan 01 02:03:34 EST 1970
GCJ:
Parsing "2:03:34"
- Result = Thu Jan 01 02:03:34 EST 1970
Parsing "2: 3:34"
java.text.ParseException: invalid Date syntax in "2: 3:34"
at java.text.DateFormat.parse (DateFormat.java:836)
at TestDateFormat.attempt (TestDateFormat.java:18)
at TestDateFormat.main (TestDateFormat.java:29)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestDateFormat.java
Type: application/octet-stream
Size: 584 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20060203/984637fb/attachment.obj>
More information about the Java
mailing list