Fun fact: SimpleDateFormat is not thread safe (apparently all DateFormat

implementations are noted in the docs as not thread safe). I specifically
verified that parse() mutates internal fields.

Since ParameterUtil is *designed* to be called by servlets which naturally run
on multiple threads, we need to be careful here to avoid getting bogus results.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2730 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2010-02-09 22:35:56 +00:00
parent c9598b3110
commit 23d8fc9876
@@ -378,7 +378,9 @@ public class ParameterUtil
throws DataValidationException
{
try {
return _dparser.parse(value);
synchronized (_dparser) {
return _dparser.parse(value);
}
} catch (ParseException pe) {
throw new DataValidationException(invalidDataMessage);
}