Author: eric
Date: Mon Jun 25 08:03:31 2012
New Revision: 1353417
URL: http://svn.apache.org/viewvc?rev=1353417&view=rev
Log:
Use HH in SimpleDateFormat to show the correct hour in Received header
(PROTOCOLS-96) + simple code format
Modified:
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java
Modified:
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java?rev=1353417&r1=1353416&r2=1353417&view=diff
==============================================================================
---
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java
(original)
+++
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java
Mon Jun 25 08:03:31 2012
@@ -32,30 +32,23 @@ import org.apache.james.protocols.smtp.S
/**
* {@link AbstractAddHeadersFilter} which adds the Received header for the
message.
- *
- *
*/
public class ReceivedDataLineFilter extends AbstractAddHeadersFilter {
-
private static final String EHLO ="EHLO";
private static final String SMTP = "SMTP";
private static final String ESMTPA = "ESMTPA";
private static final String ESMTP = "ESMTP";
private static final ThreadLocal<DateFormat> DATEFORMAT = new
ThreadLocal<DateFormat>() {
-
@Override
protected DateFormat initialValue() {
// See RFC822 for the format
- return new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss Z (zzz)",
Locale.US);
+ return new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z (zzz)",
Locale.US);
}
-
};
-
-
/**
- * Return the service type which will be used in the Received headers
+ * Return the service type which will be used in the Received headers.
*
* @param session
* @param heloMode
@@ -91,11 +84,12 @@ public class ReceivedDataLineFilter exte
}
/**
- * Return the Received header for the message
+ * Returns the Received header for the message.
*/
@SuppressWarnings("unchecked")
@Override
protected Collection<Header> headers(SMTPSession session) {
+
StringBuilder headerLineBuffer = new StringBuilder();
String heloMode = (String)
session.getAttachment(SMTPSession.CURRENT_HELO_MODE, State.Connection);
@@ -132,6 +126,9 @@ public class ReceivedDataLineFilter exte
headerLineBuffer.append(DATEFORMAT.get().format(new Date()));
header.add(headerLineBuffer.toString());
+
return Arrays.asList(header);
+
}
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]