Index: RFC822DateFormat.java
===================================================================
RCS file: /home/cvspublic/jakarta-james/src/java/org/apache/james/util/RFC822DateFormat.java,v
retrieving revision 1.3
diff -r1.3 RFC822DateFormat.java
10,12d9
< import java.text.DateFormat;
< import java.text.DecimalFormat;
< import java.text.SimpleDateFormat;
14,15c11
< import java.util.Locale;
< import java.util.TimeZone;
---
> import javax.mail.internet.MailDateFormat;
18,21c14,15
<  * I suppose I could access some of the special messages within Sun's implementation of the JavaMail
<  * API, but I've always been told not to do that.  This class has one static method that takes a
<  * java.util.Date object and returns a nicely formatted String version of this, formatted as per the
<  * RFC822 mail date format.
---
>  * A thread safe wrapper for the <code>javax.mail.internet.MailDateFormat</code> class.
>  *
22a17
>  * @author Peter M. Goldstein <farsight@alum.mit.edu>
24,27c19,20
< public class RFC822DateFormat {
<     private static DateFormat df;
<     private static DecimalFormat tz;
<     private static TimeZone defaultTZ;
---
> public class RFC822DateFormat extends SynchronizedDateFormat {
>     private static RFC822DateFormat instance; 
30,32c23
<         df = new SimpleDateFormat("EE, d MMM yyyy HH:mm:ss", Locale.ENGLISH);
<         tz = new DecimalFormat("00");
<         defaultTZ = TimeZone.getDefault();
---
>         instance = new RFC822DateFormat();
36,37c27,28
<      * SimpleDateFormat will handle most of this for us, but the
<      * timezone won't match, so we do that manually
---
>      * This static method allows us to format RFC822 dates without
>      * explicitly instantiating an RFC822DateFormat object.
40a32,36
>      *
>      * @deprecated This method is not necessary and is preserved for API
>      *             backwards compatibility.  Users of this class should
>      *             instantiate an instance and use it as they would any
>      *             other DateFormat object.
43,62c39,40
<         StringBuffer sb = new StringBuffer(df.format(d));
< 
<         sb.append(' ');
< 
<         int min = TimeZone.getDefault().getRawOffset() / 1000 / 60;
< 
<         if (defaultTZ.useDaylightTime() && defaultTZ.inDaylightTime(d)) {
<             min += 60;
<         }
< 
<         if (min >= 0) {
<             sb.append('+');
<         } else {
<             sb.append('-');
<         }
< 
<         min = Math.abs(min);
< 
<         sb.append(tz.format(min / 60));
<         sb.append(tz.format(min % 60));
---
>         return instance.format(d);
>     }
64c42,43
<         return sb.toString();
---
>     public RFC822DateFormat() {
>         super(new MailDateFormat());
