james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [07/11] james-project git commit: MAILET-121 Improve SenderIsRegex code quality a little
Date Fri, 02 Sep 2016 06:23:32 GMT
MAILET-121 Improve SenderIsRegex code quality a little


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

Branch: refs/heads/master
Commit: 8f0e26eafdf15c3c1778b78e0d7b5347a4bef46f
Parents: 1fdde84
Author: Benoit Tellier <btellier@linagora.com>
Authored: Wed Aug 31 15:14:46 2016 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Fri Sep 2 13:22:36 2016 +0700

----------------------------------------------------------------------
 .../org/apache/james/transport/matchers/SenderIsRegex.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/8f0e26ea/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIsRegex.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIsRegex.java
b/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIsRegex.java
index 31e847a..8b32a4f 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIsRegex.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIsRegex.java
@@ -17,8 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
-
 package org.apache.james.transport.matchers;
 
 import org.apache.mailet.base.GenericMatcher;
@@ -31,6 +29,8 @@ import java.util.regex.PatternSyntaxException;
 
 import javax.mail.MessagingException;
 
+import com.google.common.base.Strings;
+
 /**
  * <P>Matches mails that are sent by a sender whose address matches a regular expression.</P>
  * <P>Is equivalent to the {@link RecipientIsRegex} matcher but matching on the sender.</P>
@@ -54,11 +54,12 @@ import javax.mail.MessagingException;
  * @since 2.2.0
  */
 public class SenderIsRegex extends GenericMatcher {
-    Pattern pattern   = null;
+
+    private Pattern pattern;
 
     public void init() throws MessagingException {
         String patternString = getCondition();
-        if ((patternString == null) || (patternString.equals(""))) {
+        if (Strings.isNullOrEmpty(patternString)) {
             throw new MessagingException("Pattern is missing");
         }
         


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