james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [21/24] james-project git commit: JAMES-2366 RRT::getMappings should not return null
Date Fri, 20 Apr 2018 02:13:06 GMT
JAMES-2366 RRT::getMappings should not return null


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

Branch: refs/heads/master
Commit: b676aa991ee068cc431a26c6a571d1d84de79cf3
Parents: 10c94ea
Author: benwa <btellier@linagora.com>
Authored: Wed Apr 11 10:53:59 2018 +0700
Committer: benwa <btellier@linagora.com>
Committed: Fri Apr 20 09:12:02 2018 +0700

----------------------------------------------------------------------
 .../apache/james/rrt/lib/AbstractRecipientRewriteTable.java  | 8 ++++----
 .../transport/mailets/RecipientRewriteTableProcessor.java    | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/b676aa99/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java
----------------------------------------------------------------------
diff --git a/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java
b/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java
index c9c54b1..cc64297 100644
--- a/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java
+++ b/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java
@@ -108,7 +108,7 @@ public abstract class AbstractRecipientRewriteTable implements RecipientRewriteT
         Mappings targetMappings = mapAddress(user, domain);
 
         // Only non-null mappings are translated
-        if (targetMappings != null) {
+        if (!targetMappings.isEmpty()) {
             if (targetMappings.contains(Type.Error)) {
                 throw new ErrorMappingException(targetMappings.getError().getErrorMessage());
             } else {
@@ -142,12 +142,12 @@ public abstract class AbstractRecipientRewriteTable implements RecipientRewriteT
                         // Check if the returned mapping is the same as the
                         // input. If so return null to avoid loops
                         if (userName.equalsIgnoreCase(user) && targetDomain.equals(domain))
{
-                            return null;
+                            return MappingsImpl.empty();
                         }
 
                         Mappings childMappings = getMappings(userName, targetDomain, mappingLimit
- 1);
 
-                        if (childMappings == null || childMappings.isEmpty()) {
+                        if (childMappings.isEmpty()) {
                             // add mapping
                             mappings.add(addressWithMappingApplied);
                         } else {
@@ -162,7 +162,7 @@ public abstract class AbstractRecipientRewriteTable implements RecipientRewriteT
             }
         }
 
-        return null;
+        return MappingsImpl.empty();
     }
 
     private Optional<String> applyMapping(String user, Domain domain, String target,
Type type) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/b676aa99/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RecipientRewriteTableProcessor.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RecipientRewriteTableProcessor.java
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RecipientRewriteTableProcessor.java
index d015f54..d81f1a9 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RecipientRewriteTableProcessor.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RecipientRewriteTableProcessor.java
@@ -148,7 +148,7 @@ public class RecipientRewriteTableProcessor {
         try {
             Mappings mappings = virtualTableStore.getMappings(recipient.getLocalPart(), recipient.getDomain());
 
-            if (mappings != null) {
+            if (mappings != null && !mappings.isEmpty()) {
                 List<MailAddress> newMailAddresses = handleMappings(mappings, mail.getSender(),
recipient, mail.getMessage());
                 return RrtExecutionResult.success(newMailAddresses);
             }


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