Menu

#1873 SimpleDateConstraint should not use static SimpleDateFormat

3.6.3
closed
nobody
5
2010-03-17
2010-03-15
No

SimpleDateConstraint uses static SimpleDateFormat, however SimpleDateFormat is not thread safe.

The best solution is to have one static SimpleDateFormat, and instances would use cloned SimpleDateFormat, i.e. call _df.clone().

Discussion

  • Tom M. Yeh

    Tom M. Yeh - 2010-03-16
    • status: open --> closed
     
  • Tom M. Yeh

    Tom M. Yeh - 2010-03-16

    Fixed since 3/16
    --
    Technically, it is OK since we don't change the pattern since it is instantiated. However, to be more complaint with spec, I changed it to non-static

     
  • Ondrej Medek

    Ondrej Medek - 2010-03-16
    • status: closed --> open
     
  • Ondrej Medek

    Ondrej Medek - 2010-03-16

    FYI: AFAIK the parse() and format() method are not thread safe, because of the "protected Calendar calendar" field on the DateFormat class.

     
  • Tom M. Yeh

    Tom M. Yeh - 2010-03-17
    • status: open --> closed
     

Log in to post a comment.