You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/11/05 02:49:45 UTC
[james-project] branch master updated: JAMES-3666 Fix DSNBounce
exception when no Date header is present
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
The following commit(s) were added to refs/heads/master by this push:
new 8368912 JAMES-3666 Fix DSNBounce exception when no Date header is present
8368912 is described below
commit 8368912b3fbb8f3c84a5229a1bbe1452625f7847
Author: Karsten Otto <ka...@akquinet.de>
AuthorDate: Tue Nov 2 10:11:44 2021 +0100
JAMES-3666 Fix DSNBounce exception when no Date header is present
---
.../src/main/java/org/apache/james/transport/mailets/DSNBounce.java | 3 +--
.../test/java/org/apache/james/transport/mailets/DSNBounceTest.java | 1 +
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
index aa24357..5fb4ec8 100755
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
@@ -23,7 +23,6 @@ import static org.apache.james.transport.mailets.remote.delivery.Bouncer.DELIVER
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
@@ -361,7 +360,7 @@ public class DSNBounce extends GenericMailet implements RedirectNotify {
private String getDateHeader(Mail originalMail) throws MessagingException {
String[] date = originalMail.getMessage().getHeader(RFC2822Headers.DATE);
if (date == null) {
- return dateFormatter.format(LocalDateTime.now());
+ return dateFormatter.format(ZonedDateTime.now());
}
return date[0];
}
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
index 84b8248..a448476 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
@@ -216,6 +216,7 @@ public class DSNBounceTest {
.recipient("recipient@domain.com")
.lastUpdated(Date.from(Instant.parse("2016-09-08T14:25:52.000Z")))
.build();
+ mail.getMessage().removeHeader(RFC2822Headers.DATE);
dsnBounce.service(mail);
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org