Peacetime use of SimpleDateFormat is in the case of a single thread, today in rewriting the code of others, found that each class will write a large number of SimpleDateFormat instances. As a program-specific cleanliness begins to optimize the code.
In fact, the so-called optimization operation is also very simple, that is, all the SimpleDateFormat into a dateutils class, and provide a static method.
After optimization, strange things happen. Partial program reports the following exception:
Java.lang.NumberFormatException:multiple points
With a puzzled search solution, and look at the project code, it turns out that some of the optimization is really good to do bad things. Originally, some of the code used multithreading. The SimpleDateFormat can not be used when multiple threads are ignored for optimization. The reason is simple SimpleDateFormat is not thread safe.
Here's a record of the pit you stepped on.