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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user