Any use of java.text.DateFormat (or its subclasses) format method is thread unsafe (quite to my surprise). The problem comes from DateFormat holding an instance of a Calendar to help it break the java.util.Date into pieces.
When a second thread calls format() while another thread is still in format(), it naturally starts poking the new month/day/etc into the [same!] calendar, overwriting what the first thread put there [and is still using]. It goes downhill from there. I got anything from garbled/mixed dates to NullPointerExceptions, depending on when and where the two threads were. Jeff -----Original Message----- From: Keith Bacon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 05, 2002 5:12 AM To: Struts Users Mailing List Subject: Thread Safety Question (was Formatting Dates, Integers...) Do you know what the problem was that made your use of format objects non-thread safe? > -----Original Message----- > From: Jeff Martin [mailto:[EMAIL PROTECTED]] > Sent: Monday, February 04, 2002 5:56 PM > To: Struts Users Mailing List > Subject: RE: Formatting Dates, Integers... > > > Be very careful about using DateFormatter's that way. I learned a hard > lesson in a previous project that DateFormater (and even just the format > method) is not thread safe. > > Jeff > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>