james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rouaz...@apache.org
Subject [09/50] [abbrv] james-project git commit: MAILET-115 Remove abstract getReplyTo implementation
Date Wed, 11 Jan 2017 09:25:57 GMT
MAILET-115 Remove abstract getReplyTo implementation


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/a09337de
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/a09337de
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/a09337de

Branch: refs/heads/master
Commit: a09337dee5503e4bdf2d5e95bf01bcfffdb8ed82
Parents: 691a295
Author: Antoine Duprat <aduprat@apache.org>
Authored: Wed Oct 5 11:53:34 2016 +0200
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Wed Jan 11 10:03:28 2017 +0700

----------------------------------------------------------------------
 .../apache/james/transport/mailets/Bounce.java   |  5 +++++
 .../james/transport/mailets/DSNBounce.java       |  5 +++++
 .../transport/mailets/NotifyPostmaster.java      |  6 ++++++
 .../james/transport/mailets/NotifySender.java    |  5 +++++
 .../apache/james/transport/mailets/Redirect.java | 17 +++++++++++++++++
 .../apache/james/transport/mailets/Resend.java   | 17 +++++++++++++++++
 .../mailets/redirect/AbstractRedirect.java       | 19 +------------------
 .../mailets/redirect/AbstractRedirectTest.java   |  5 +++++
 8 files changed, 61 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/a09337de/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
index ad605c8..91f3257 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
@@ -152,6 +152,11 @@ public class Bounce extends AbstractRedirect {
     }
 
     @Override
+    protected MailAddress getReplyTo() throws MessagingException {
+        return SpecialAddress.NULL;
+    }
+
+    @Override
     protected MailAddress getReversePath(Mail originalMail) {
         return SpecialAddress.NULL;
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/a09337de/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
----------------------------------------------------------------------
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 f3863fa..b69a905 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
@@ -146,6 +146,11 @@ public class DSNBounce extends AbstractRedirect {
     }
 
     @Override
+    protected MailAddress getReplyTo() throws MessagingException {
+        return SpecialAddress.NULL;
+    }
+
+    @Override
     protected MailAddress getReversePath(Mail originalMail) {
         return SpecialAddress.NULL;
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/a09337de/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifyPostmaster.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifyPostmaster.java
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifyPostmaster.java
index c58b581..86d3e6b 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifyPostmaster.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifyPostmaster.java
@@ -30,6 +30,7 @@ import org.apache.james.transport.mailets.redirect.AddressExtractor;
 import org.apache.james.transport.mailets.redirect.InitParameters;
 import org.apache.james.transport.mailets.redirect.NotifyMailetInitParameters;
 import org.apache.james.transport.mailets.redirect.NotifyMailetsMessage;
+import org.apache.james.transport.mailets.redirect.SpecialAddress;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.MailetConfig;
@@ -168,4 +169,9 @@ public class NotifyPostmaster extends AbstractRedirect {
         return new InternetAddress[] { getMailetContext().getPostmaster().toInternetAddress()
};
     }
 
+    @Override
+    protected MailAddress getReplyTo() throws MessagingException {
+        return SpecialAddress.NULL;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/a09337de/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifySender.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifySender.java
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifySender.java
index 75bad9c..959c605 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifySender.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifySender.java
@@ -169,4 +169,9 @@ public class NotifySender extends AbstractRedirect {
         }
         return new InternetAddress[] { SpecialAddress.SENDER.toInternetAddress() };
     }
+
+    @Override
+    protected MailAddress getReplyTo() throws MessagingException {
+        return SpecialAddress.NULL;
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/a09337de/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Redirect.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Redirect.java
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Redirect.java
index 066a4cf..54ae60e 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Redirect.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Redirect.java
@@ -34,6 +34,7 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 
 import com.google.common.base.Optional;
+import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 
@@ -367,6 +368,22 @@ public class Redirect extends AbstractRedirect {
     }
 
     @Override
+    protected MailAddress getReplyTo() throws MessagingException {
+        String replyTo = getInitParameters().getReplyTo();
+        if (Strings.isNullOrEmpty(replyTo)) {
+            return null;
+        }
+
+        List<MailAddress> extractAddresses = AddressExtractor.withContext(getMailetContext())
+                .allowedSpecials(ImmutableList.of("postmaster", "sender", "null", "unaltered"))
+                .extract(replyTo);
+        if (extractAddresses.isEmpty()) {
+            return null;
+        }
+        return extractAddresses.get(0);
+    }
+
+    @Override
     protected MailAddress getReversePath() throws MessagingException {
         String addressString = getInitParameter("reversePath");
         if (addressString == null) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/a09337de/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Resend.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Resend.java
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Resend.java
index 00fe973..a258c6f 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Resend.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Resend.java
@@ -31,6 +31,7 @@ import org.apache.james.transport.mailets.redirect.RedirectMailetInitParameters;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 
+import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableList;
 
 /**
@@ -323,4 +324,20 @@ public class Resend extends AbstractRedirect {
       return addresses.toArray(new InternetAddress[addresses.size()]);
     }
 
+    @Override
+    protected MailAddress getReplyTo() throws MessagingException {
+        String replyTo = getInitParameters().getReplyTo();
+        if (Strings.isNullOrEmpty(replyTo)) {
+            return null;
+        }
+
+        List<MailAddress> extractAddresses = AddressExtractor.withContext(getMailetContext())
+                .allowedSpecials(ImmutableList.of("postmaster", "sender", "null", "unaltered"))
+                .extract(replyTo);
+        if (extractAddresses.isEmpty()) {
+            return null;
+        }
+        return extractAddresses.get(0);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/a09337de/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/AbstractRedirect.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/AbstractRedirect.java
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/AbstractRedirect.java
index bc00777..a2c2a5d 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/AbstractRedirect.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/AbstractRedirect.java
@@ -299,24 +299,7 @@ public abstract class AbstractRedirect extends GenericMailet {
      *         <code>SpecialAddress.UNALTERED</code> or
      *         <code>SpecialAddress.NULL</code> or <code>null</code>
if missing
      */
-    protected MailAddress getReplyTo() throws MessagingException {
-        if (isNotifyMailet()) {
-            return SpecialAddress.NULL;
-        }
-
-        String replyTo = getInitParameters().getReplyTo();
-        if (Strings.isNullOrEmpty(replyTo)) {
-            return null;
-        }
-
-        List<MailAddress> extractAddresses = AddressExtractor.withContext(getMailetContext())
-                .allowedSpecials(ImmutableList.of("postmaster", "sender", "null", "unaltered"))
-                .extract(replyTo);
-        if (extractAddresses.isEmpty()) {
-            return null;
-        }
-        return extractAddresses.get(0);
-    }
+    protected abstract MailAddress getReplyTo() throws MessagingException;
 
     /**
      * Gets the <code>replyTo</code> property, built dynamically using the

http://git-wip-us.apache.org/repos/asf/james-project/blob/a09337de/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AbstractRedirectTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AbstractRedirectTest.java
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AbstractRedirectTest.java
index b5b1a12..805a4ee 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AbstractRedirectTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AbstractRedirectTest.java
@@ -74,6 +74,11 @@ public class AbstractRedirectTest {
         protected InternetAddress[] getTo() throws MessagingException {
             return null;
         }
+
+        @Override
+        protected MailAddress getReplyTo() throws MessagingException {
+            return null;
+        }
     }
 
     @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message