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: kaz at maczuka dot gcd dot org
Subject: [Bug classpath/30359] SimpleDateFormat parse "invalid Date syntax in" exception
Date: 17 Jan 2007 22:31:08 -0000


------- Comment #2 from kaz at maczuka dot gcd dot org  2007-01-17 22:31 -------
On Kaffe, an exception is not thrown, but SimpleDateFormat gives invalid parsed
result in some cases.  Testcase:  import java.text.SimpleDateFormat; import
java.util.Date;  public class TestSimpleDateFormat {   public static void
main(String[] args) throws Exception {     SimpleDateFormat sdf = new
SimpleDateFormat(args[0]);     Date d = sdf.parse(args[1]);    
System.out.println(d);   } }  Results: $ java TestSimpleDateFormat yyMM 0701
Sat Jan 01 00:00:00 GMT+09:00 0701 $ java TestSimpleDateFormat yy 07   Sat Jan
01 00:00:00 GMT+09:00 0007  NumberFormat#parse used in SimpleDateFormat seems
to be the cause of this trouble.  Testcase:  import java.text.*; import
java.util.*;  public class TestNumberFormat {    public static void
main(String[] args) {     Locale locale = Locale.getDefault();     NumberFormat
nf = NumberFormat.getInstance(locale);     nf.setMinimumIntegerDigits(2);    
nf.setMaximumIntegerDigits(2);     ParsePosition pos = new ParsePosition(0);   
 Number n = nf.parse(args[0], pos);     System.out.println(n);   }  }  Results:
$ java TestNumberFormat 0701 701 $ java TestNumberFormat 0700001 700001  I am
afraid setMaximumIntegerDigits does not work as expected.  But Sun's JDK gives
similar results for TestNumberFormat.  


-- 


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





reply via email to

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