james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rouaz...@apache.org
Subject [12/50] [abbrv] james-project git commit: MAILET-115 Remove abstract getReversePath implementation
Date Wed, 11 Jan 2017 09:26:00 GMT
MAILET-115 Remove abstract getReversePath 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/33deb2ea
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/33deb2ea
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/33deb2ea

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

----------------------------------------------------------------------
 .../org/apache/james/transport/mailets/Forward.java |  5 +++++
 .../james/transport/mailets/NotifyPostmaster.java   |  5 +++++
 .../james/transport/mailets/NotifySender.java       |  5 +++++
 .../apache/james/transport/mailets/Redirect.java    | 12 +++++++++++-
 .../org/apache/james/transport/mailets/Resend.java  | 11 +++++++++++
 .../mailets/redirect/AbstractRedirect.java          | 16 ++--------------
 .../mailets/redirect/AbstractRedirectTest.java      |  5 +++++
 7 files changed, 44 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/33deb2ea/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java
index 0c68360..ecbc9d4 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java
@@ -169,6 +169,11 @@ public class Forward extends AbstractRedirect {
     }
 
     @Override
+    protected MailAddress getReversePath(Mail originalMail) throws MessagingException {
+        return null;
+    }
+
+    @Override
     protected MailAddress getSender() throws MessagingException {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/33deb2ea/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 86d3e6b..153d433 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
@@ -174,4 +174,9 @@ public class NotifyPostmaster extends AbstractRedirect {
         return SpecialAddress.NULL;
     }
 
+    @Override
+    protected MailAddress getReversePath(Mail originalMail) throws MessagingException {
+        return getSender(originalMail);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/33deb2ea/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 959c605..0e37607 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
@@ -174,4 +174,9 @@ public class NotifySender extends AbstractRedirect {
     protected MailAddress getReplyTo() throws MessagingException {
         return SpecialAddress.NULL;
     }
+
+    @Override
+    protected MailAddress getReversePath(Mail originalMail) throws MessagingException {
+        return getSender(originalMail);
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/33deb2ea/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 54ae60e..dd692f3 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
@@ -398,11 +398,21 @@ public class Redirect extends AbstractRedirect {
 
     @Override
     protected MailAddress getReversePath(Mail originalMail) throws MessagingException {
-        MailAddress reversePath = super.getReversePath(originalMail);
+        MailAddress reversePath = retrieveReversePath();
         if (reversePath != null) {
             return reversePath;
         }
         return getSender(originalMail);
     }
 
+    private MailAddress retrieveReversePath() throws MessagingException {
+        MailAddress reversePath = getReversePath();
+        if (reversePath != null) {
+            if (isUnalteredOrReversePathOrSender(reversePath)) {
+                return null;
+            }
+        }
+        return reversePath;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/33deb2ea/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 a258c6f..8d0cb0b 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
@@ -340,4 +340,15 @@ public class Resend extends AbstractRedirect {
         return extractAddresses.get(0);
     }
 
+    @Override
+    protected MailAddress getReversePath(Mail originalMail) throws MessagingException {
+        MailAddress reversePath = getReversePath();
+        if (reversePath != null) {
+            if (isUnalteredOrReversePathOrSender(reversePath)) {
+                return null;
+            }
+        }
+        return reversePath;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/33deb2ea/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 a2c2a5d..6f30633 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
@@ -380,21 +380,9 @@ public abstract class AbstractRedirect extends GenericMailet {
      *         but not replacing <code>SpecialAddress.NULL</code> that will be
      *         handled by {@link #setReversePath}
      */
-    protected MailAddress getReversePath(Mail originalMail) throws MessagingException {
-        if (isNotifyMailet()) {
-            return getSender(originalMail);
-        }
-
-        MailAddress reversePath = getReversePath();
-        if (reversePath != null) {
-            if (isUnalteredOrReversePathOrSender(reversePath)) {
-                return null;
-            }
-        }
-        return reversePath;
-    }
+    protected abstract MailAddress getReversePath(Mail originalMail) throws MessagingException;
 
-    private boolean isUnalteredOrReversePathOrSender(MailAddress reversePath) {
+    protected boolean isUnalteredOrReversePathOrSender(MailAddress reversePath) {
         return reversePath.equals(SpecialAddress.UNALTERED)
                 || reversePath.equals(SpecialAddress.REVERSE_PATH)
                 || reversePath.equals(SpecialAddress.SENDER);

http://git-wip-us.apache.org/repos/asf/james-project/blob/33deb2ea/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 805a4ee..c8926fd 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
@@ -79,6 +79,11 @@ public class AbstractRedirectTest {
         protected MailAddress getReplyTo() throws MessagingException {
             return null;
         }
+
+        @Override
+        protected MailAddress getReversePath(Mail originalMail) 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