# 问题代码
private static final DateFormat df = new SimpleDateFormat("yyyy年MM月"); | |
public String convertDate( Date date ){ | |
String date = df.format(date); | |
return date; | |
} |
# 官方解释
Call to static DateFormat
As the JavaDoc states, DateFormats are inherently unsafe for multithreaded use. The detector has found a call to an instance of DateFormat that has been obtained via a static field. This looks suspicous.
For more information on this see Sun Bug #6231579 and Sun Bug #6178997.
Sun Bug #6231579
Sun Bug #6178997
DateFormat 不是线程安全的