Skip to main content

What it flags

An unsynchronized call to a static java.text.SimpleDateFormat field. If the method runs concurrently, each call can mutate the formatter while another call uses it. Java API documentation The check recognizes a dedicated lock when a top-level class creates a private formatter in its field declaration and keeps every use under the same lock without sharing the instance. It also skips direct class initialization and calls on enhanced-for variables that shadow the field. Calls inside callbacks declared by an initializer are still checked.

How to review or fix

Check how the formatter is shared. Synchronize access or give each thread its own instance. Before moving to DateTimeFormatter, verify that the pattern and time zone semantics match.