This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

SimpleDateFormat parse bug: doesn't like embedded spaces


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)

Attachment: TestDateFormat.java
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]