From a7d1f09b5ce469037cd13916aae9378d3b4c756e Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Mon, 7 Mar 2022 10:26:24 +0100 Subject: [PATCH] Document SimpleDateFormat not thread-safe --- pgpainless-core/src/main/java/org/pgpainless/util/DateUtil.java | 1 + 1 file changed, 1 insertion(+) diff --git a/pgpainless-core/src/main/java/org/pgpainless/util/DateUtil.java b/pgpainless-core/src/main/java/org/pgpainless/util/DateUtil.java index 0cec35d9..ad1fce09 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/util/DateUtil.java +++ b/pgpainless-core/src/main/java/org/pgpainless/util/DateUtil.java @@ -15,6 +15,7 @@ public final class DateUtil { } + // Java's SimpleDateFormat is not thread-safe, therefore we return a new instance on every invocation. public static SimpleDateFormat getParser() { SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); parser.setTimeZone(TimeZone.getTimeZone("UTC"));