forked from I2P_Developers/i2p.i2p
SusiMail: Static DateFormatters
This commit is contained in:
@ -280,17 +280,19 @@ class Mail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseHeaders()
|
private static final DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
{
|
private static DateFormat localDateFormatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
||||||
DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
private static DateFormat longLocalDateFormatter = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
|
||||||
DateFormat localDateFormatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
private static DateFormat mailDateFormatter = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z", Locale.ENGLISH );
|
||||||
DateFormat longLocalDateFormatter = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
|
static {
|
||||||
// the router sets the JVM time zone to UTC but saves the original here so we can get it
|
// the router sets the JVM time zone to UTC but saves the original here so we can get it
|
||||||
TimeZone tz = SystemVersion.getSystemTimeZone();
|
TimeZone tz = SystemVersion.getSystemTimeZone();
|
||||||
localDateFormatter.setTimeZone(tz);
|
localDateFormatter.setTimeZone(tz);
|
||||||
longLocalDateFormatter.setTimeZone(tz);
|
longLocalDateFormatter.setTimeZone(tz);
|
||||||
DateFormat mailDateFormatter = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z", Locale.ENGLISH );
|
}
|
||||||
|
|
||||||
|
private void parseHeaders()
|
||||||
|
{
|
||||||
error = "";
|
error = "";
|
||||||
if( header != null ) {
|
if( header != null ) {
|
||||||
|
|
||||||
@ -340,12 +342,14 @@ class Mail {
|
|||||||
else if (hlc.startsWith("date:")) {
|
else if (hlc.startsWith("date:")) {
|
||||||
dateString = line.substring( 5 ).trim();
|
dateString = line.substring( 5 ).trim();
|
||||||
try {
|
try {
|
||||||
|
synchronized(mailDateFormatter) {
|
||||||
date = mailDateFormatter.parse( dateString );
|
date = mailDateFormatter.parse( dateString );
|
||||||
formattedDate = dateFormatter.format( date );
|
formattedDate = dateFormatter.format( date );
|
||||||
localFormattedDate = localDateFormatter.format( date );
|
localFormattedDate = localDateFormatter.format( date );
|
||||||
//quotedDate = html.encode( dateString );
|
//quotedDate = html.encode( dateString );
|
||||||
quotedDate = longLocalDateFormatter.format(date);
|
quotedDate = longLocalDateFormatter.format(date);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (ParseException e) {
|
catch (ParseException e) {
|
||||||
date = null;
|
date = null;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Reference in New Issue
Block a user