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 2018/12/11 07:01:21 UTC

[2/7] james-project git commit: JAMES-2557 Improve MailCmdHandler: Simplify removeBrackets condition

JAMES-2557 Improve MailCmdHandler: Simplify removeBrackets condition

If useAddressBracketsEnforcement is enforced, the brackets are checks to be present.

We can remove this redundant condition for simplicity.


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

Branch: refs/heads/master
Commit: cc795348eebf39fbcd81531cef25f34306ce0368
Parents: 7a6d572
Author: Benoit Tellier <bt...@linagora.com>
Authored: Fri Dec 7 09:30:54 2018 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Tue Dec 11 13:59:20 2018 +0700

----------------------------------------------------------------------
 .../org/apache/james/protocols/smtp/core/MailCmdHandler.java  | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/cc795348/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java
----------------------------------------------------------------------
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java
index 9bce885..6aab40c 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java
@@ -215,7 +215,7 @@ public class MailCmdHandler extends AbstractHookableCmdHandler<MailHook> {
                 return SYNTAX_ERROR;
             }
             try {
-                MaybeSender senderAddress = toMaybeSender(removeBrackets(session, sender));
+                MaybeSender senderAddress = toMaybeSender(removeBrackets(sender));
                 // Store the senderAddress in session map
                 session.setAttachment(SMTPSession.SENDER, senderAddress, State.Transaction);
             } catch (Exception pe) {
@@ -238,9 +238,8 @@ public class MailCmdHandler extends AbstractHookableCmdHandler<MailHook> {
             appendDefaultDomainIfNeeded(senderAsString)));
     }
 
-    private String removeBrackets(SMTPSession session, String input) {
-        if (session.getConfiguration().useAddressBracketsEnforcement()
-            || (input.startsWith("<") && input.endsWith(">"))) {
+    private String removeBrackets(String input) {
+        if (input.startsWith("<") && input.endsWith(">")) {
             // Remove < and >
             return input.substring(1, input.length() - 1);
         }


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