Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Prevent race condition when switching timezones.

hermens2173865f92da
diff --git a/source/de/anomic/kelondro/order/DateFormatter.java b/source/de/anomic/kelondro/order/DateFormatter.java
index 9703f0627..30e9357a9 100644
--- a/source/de/anomic/kelondro/order/DateFormatter.java
+++ b/source/de/anomic/kelondro/order/DateFormatter.java
@@ -397,10 +397,10 @@ public final class DateFormatter {
/** called by all public format...(..., TimeZone) methods */
private static String format(final SimpleDateFormat format, final Date date, final TimeZone tz) {
- final TimeZone bakTZ = format.getTimeZone();
String result;
synchronized (format) {
+ final TimeZone bakTZ = format.getTimeZone();
format.setTimeZone(tz == null ? TZ_GMT : tz);
result = format.format(date);
format.setTimeZone(bakTZ);