The javadoc for SimpleDateFormat will confirm: this class isn’t thread safe. Internally, it mutates several mutable fields in the process of parsing and formatting. Accessing instances of SimpleDateFormat from multiple threads concurrently (to perform either operation) can lead to either unexpected “impossible“ exceptions or silently corrupt results.
To fix this issue, the following usages (at least, I only looked through 1.3.8 not master to find these) need to be modified to either put the SimpleDateFormat inside of a ThreadLocal, create each SimpleDateFormat instance per usage, or use JDK 8’s DateTimeFormatter which is immutable and thread safe:
The javadoc for SimpleDateFormat will confirm: this class isn’t thread safe. Internally, it mutates several mutable fields in the process of parsing and formatting. Accessing instances of SimpleDateFormat from multiple threads concurrently (to perform either operation) can lead to either unexpected “impossible“ exceptions or silently corrupt results.
To fix this issue, the following usages (at least, I only looked through 1.3.8 not master to find these) need to be modified to either put the SimpleDateFormat inside of a ThreadLocal, create each SimpleDateFormat instance per usage, or use JDK 8’s DateTimeFormatter which is immutable and thread safe: