here some pittfalls of the Sun's date utilitites that I encoutnered.
a) The *parser* in the SimpleDateFormat is not thread safe.
b) The ParseException acts differently in every version since JDK1.1.7
(expliecetly an unusable errorOffset).
c) It allows negative months and other components, thus fails with
ISO8601 abbreviated dates (e.g. --01T00:00Z meaning midnight of
every first day in a month)
d) many more (I had a lot of workarounds to get my application
do proper parsing in a controlled input field - thats why JDK1.4
no allows qualified input fields with REs!)
I took a quick look at Joda's date parser and saw it has its own
engine.
I believe the commons one should lean onto the syntax of the java's,
such that should allow it as a bug free plug-in replacement of Sun's.
What do others think? I need to take a look at Ant's code. Maybe
I'll take the leap and start a working bug free plug-in replacement
of Sun's SimpleDateFormat if no one has taken the lead...
Cheers,
Christoph
Sean Schofield wrote:
Please be warned, that Date is a fragile/controversial issue, since
1. The java SimpleDateFormatter is not thread safe
2. Dates have many locale specific representation.
Indeed, Sun's dates are pretty rubbish. Joda has a 0.8 release, which has
thread safe formatting including time zone handling and locale
handling. It
still needs more work though.
Stephen
What is not thread safe about SimpleDateFormatter? If this is true that
seems kind of serious! (I will take a look at the source tonight but it
might help if you gave me a hint)
Anyways, this thread safety business sounds like something that might be
useful to a lot of programmers out there. I will take a look at what
you've done in joda and see if I can't figure it out. Maybe we could
make a thread-safe version of SimpleDate Formatter be part of the
proposed TimeUtils/DateUtils/whatever in commons-lang?
Thoughts?
- sean
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
:) Christoph Reck
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>