You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2020/03/20 12:15:47 UTC

[james-project] 04/08: JAMES-3113 LocalResources: rely on Username POJO

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

commit b7268eee7880b6bcd9a45c925f28a3db618064d4
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Mar 18 10:13:31 2020 +0700

    JAMES-3113 LocalResources: rely on Username POJO
---
 .../apache/james/mailetcontainer/impl/LocalResources.java | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/LocalResources.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/LocalResources.java
index 7cdeab5..509f80b 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/LocalResources.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/LocalResources.java
@@ -68,16 +68,11 @@ class LocalResources {
             return false;
         }
         try {
-            if (!name.contains("@")) {
-                try {
-                    return isLocalEmail(new MailAddress(name.toLowerCase(Locale.US), domains.getDefaultDomain().asString()));
-                } catch (DomainListException e) {
-                    LOGGER.error("Unable to access DomainList", e);
-                    return false;
-                }
-            } else {
-                return isLocalEmail(new MailAddress(name.toLowerCase(Locale.US)));
-            }
+            MailAddress mailAddress = Username.of(name).withDefaultDomain(domains.getDefaultDomain()).asMailAddress();
+            return isLocalEmail(mailAddress);
+        } catch (DomainListException e) {
+            LOGGER.error("Unable to access DomainList", e);
+            return false;
         } catch (ParseException e) {
             LOGGER.info("Error checking isLocalUser for user {}", name, e);
             return false;


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