james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [04/11] james-project git commit: MAILET-121 SenderIs should rely on email condition reader
Date Fri, 02 Sep 2016 06:23:29 GMT
MAILET-121 SenderIs should rely on email condition reader


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

Branch: refs/heads/master
Commit: 9736dfc04ddfa7641bb7814752b9bc61cbf02c79
Parents: 1a13bf3
Author: Benoit Tellier <btellier@linagora.com>
Authored: Wed Aug 31 17:56:13 2016 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Fri Sep 2 13:22:36 2016 +0700

----------------------------------------------------------------------
 .../apache/james/transport/matchers/SenderIs.java | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/9736dfc0/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIs.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIs.java
b/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIs.java
index 60cb5ea..0774a2c 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIs.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIs.java
@@ -23,20 +23,14 @@ import java.util.Collection;
 import java.util.Set;
 
 import javax.mail.MessagingException;
-import javax.mail.internet.AddressException;
 
+import org.apache.james.transport.matchers.utils.MailAddressCollectionReader;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.GenericMatcher;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Splitter;
 import com.google.common.base.Strings;
-import com.google.common.base.Throwables;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
 
 public class SenderIs extends GenericMatcher {
 
@@ -51,15 +45,7 @@ public class SenderIs extends GenericMatcher {
         if (Strings.isNullOrEmpty(getCondition())) {
             throw new MessagingException("SenderIs should have at least one address as parameter");
         }
-        senders = FluentIterable.from(Splitter.on(", ").split(getCondition())).transform(new
Function<String, MailAddress>() {
-            public MailAddress apply(String s) {
-                try {
-                    return new MailAddress(s);
-                } catch (AddressException e) {
-                    throw Throwables.propagate(e);
-                }
-            }
-        }).toSet();
+        senders = MailAddressCollectionReader.read(getCondition());
         if (senders.size() < 1) {
             throw new MessagingException("SenderIs should have at least one address as parameter");
         }


---------------------------------------------------------------------
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