Skip to content

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

*) adding synchronization block because SimpleDateFormat is not thread-safe See: http://www.yacy-forum.de/viewtopic.php?p=26906#26906

thelib357a13e9a14
diff --git a/source/de/anomic/http/httpc.java b/source/de/anomic/http/httpc.java
index 0a5656058..2473cd069 100644
--- a/source/de/anomic/http/httpc.java
+++ b/source/de/anomic/http/httpc.java
@@ -545,7 +545,15 @@ public final class httpc {
*/
public static String dateString(Date date) {
if (date == null) return "";
- return HTTPGMTFormatter.format(date);
+
+ /*
+ * This synchronized is needed because SimpleDateFormat
+ * is not thread-safe.
+ * See: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6231579
+ */
+ synchronized(HTTPGMTFormatter) {
+ return HTTPGMTFormatter.format(date);
+ }
}
/**