Index: RFC822Date.java
===================================================================
RCS file: /home/cvspublic/jakarta-james/src/java/org/apache/james/util/RFC822Date.java,v
retrieving revision 1.3
diff -r1.3 RFC822Date.java
10,11d9
< import java.text.DateFormat;
< import java.text.DecimalFormat;
27a26,28
>  * @author Peter M. Goldstein <farsight@alum.mit.edu><br>
>  *
>  * @deprecated Use java.util.Date in combination with org.apache.james.util.RFC822DateFormat.
30c31
<     private static DateFormat df;
---
>     private static SimpleDateFormat df;
34,35d34
<     private static DecimalFormat tz;
<     private TimeZone defaultTZ;
36a36
>     private RFC822DateFormat rfc822Format = new RFC822DateFormat();
43d42
< 	  	tz = new DecimalFormat("00"); 
51c50
< public RFC822Date(){
---
>     public RFC822Date(){
53d51
<     	defaultTZ = TimeZone.getDefault();
61c59
<     public RFC822Date(Date da){
---
>     public RFC822Date(Date da) {
63d60
<     	defaultTZ = TimeZone.getDefault();
80d76
<     	defaultTZ = TimeZone.getTimeZone(useTZ);
92d87
< 		defaultTZ = TimeZone.getDefault();
103c98
< 		defaultTZ = TimeZone.getTimeZone(useTZ);
---
> 		setTimeZone(useTZ);
119,129c114,128
<     	String exceptions;
<     	int exceptionoff;
< 		try{
< 			d= dx.parse(rfcdate);
< 		}catch(ParseException  e){
< 			try{
< 				d= dz.parse(rfcdate);
< 			}catch(ParseException  f){
< 				try{
< 					d= dy.parse(rfcdate);
< 				}catch(ParseException  g){
---
> 		try {
> 			synchronized (dx) {
> 			    d= dx.parse(rfcdate);
> 			}
> 		} catch(ParseException e) {
> 			try {
> 				synchronized (dz) {
> 					d= dz.parse(rfcdate);
> 				}
> 			} catch(ParseException f) {
> 				try {
> 					synchronized (dy) {
> 						d = dy.parse(rfcdate);
> 					}
> 				} catch(ParseException g) {
138,139c137,138
<     public void setTimeZone(TimeZone useTZ){
<     	defaultTZ = useTZ;
---
>     public void setTimeZone(TimeZone useTZ) {
>         rfc822Format.setTimeZone(useTZ);
142,143c141,142
<     public void setTimeZone(String useTZ){
<     	defaultTZ = TimeZone.getTimeZone(useTZ);
---
>     public void setTimeZone(String useTZ) {
>     	setTimeZone(TimeZone.getTimeZone(useTZ));
151c150
<     public Date getDate(){
---
>     public Date getDate() {
161,176c160,161
<     public  String toString() {
<         StringBuffer sb = new StringBuffer(df.format(d));
<         sb.append(' ');
<         int min = defaultTZ.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 sb.toString();
---
>     public String toString() {
>         return rfc822Format.format(d);
