are you sharing the instance of SimpleDateFormat? It is in fact not thread safe - this might be causing your issue.
On 26 January 2011 15:36, Jason Purcell <[email protected]> wrote: > Hi there... > > I am getting intermittent exceptions when parsing dates. > > My formatter is declared as follows: > > SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); > dateFormat.setLenient(false); > > These are some of the exceptions that have been thrown: > > java.text.ParseException: Unparseable date: "02/04/1980" > java.text.ParseException: Unparseable date: "20/06/1985" > java.text.ParseException: Unparseable date: "05/03/1990" > java.text.ParseException: Unparseable date: "14/09/1973" > java.text.ParseException: Unparseable date: "25/01/2011" > java.text.ParseException: Unparseable date: "25/01/2011" > java.text.ParseException: Unparseable date: "09/07/1965" > java.text.ParseException: Unparseable date: "07/10/1974" > java.text.ParseException: Unparseable date: "27/08/1966" > > My unit tests pass when using the "unparseable" dates above, and in > production dates parse correctly basically 99.999% of the time in the > relevant piece of code. > > As an example, the following dates parse correctly: > > 07/06/1978 > 14/06/1981 > 04/01/1988 > 03/10/1965 > 12/09/1977 > 30/01/1985 > > Has anyone come across this before? > > Is there a problem with using SimpleDateFormat.setLenient() perhaps? > > Regards, > Jason. > > > -- > You received this message because you are subscribed to the Google Groups > "CTJUG Tech" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<ctjug-tech%[email protected]> > For more options, visit this group at > http://groups.google.com/group/CTJUG-Tech?hl=en > For Cape Town Java User Group home page see http://www.ctjug.org.za/ > For jobs see http://jobs.gamatam.com/ -- see my blog: http://analysis102.blogspot.com http://audiblethoughts.blogspot.com http://outsideofficehours.blogspot.com -- You received this message because you are subscribed to the Google Groups "CTJUG Tech" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/CTJUG-Tech?hl=en For Cape Town Java User Group home page see http://www.ctjug.org.za/ For jobs see http://jobs.gamatam.com/
