You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jk...@apache.org on 2009/02/06 11:21:25 UTC

svn commit: r741506 - /ant/core/trunk/src/main/org/apache/tools/ant/util/DateUtils.java

Author: jkf
Date: Fri Feb  6 10:21:24 2009
New Revision: 741506

URL: http://svn.apache.org/viewvc?rev=741506&view=rev
Log:
Deprecated the public DateFormat

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/util/DateUtils.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/DateUtils.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/DateUtils.java?rev=741506&r1=741505&r2=741506&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/DateUtils.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/DateUtils.java Fri Feb  6 10:21:24 2009
@@ -62,11 +62,17 @@
 
     /**
      * Format used for SMTP (and probably other) Date headers.
+     * @deprecated DateFormat is not thread safe, and we cannot guarantee that
+     * some other code is using the format in parallel.
+     * Deprecated since ant 1.8
      */
     public static final DateFormat DATE_HEADER_FORMAT
         = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss ", Locale.US);
 
-
+    private static final DateFormat DATE_HEADER_FORMAT_INT
+    = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss ", Locale.US);
+    
+    
 // code from Magesh moved from DefaultLogger and slightly modified
     private static final MessageFormat MINUTE_SECONDS
             = new MessageFormat("{0}{1}");
@@ -221,8 +227,8 @@
             tzMarker.append("0");
         }
         tzMarker.append(minutes);
-        synchronized (DATE_HEADER_FORMAT) {
-            return DATE_HEADER_FORMAT.format(cal.getTime()) + tzMarker.toString();
+        synchronized (DATE_HEADER_FORMAT_INT) {
+            return DATE_HEADER_FORMAT_INT.format(cal.getTime()) + tzMarker.toString();
         }
     }