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 ro...@apache.org on 2016/11/23 13:50:28 UTC
[25/46] james-project git commit: JAMES-1854 Use preconditions
instead of if
JAMES-1854 Use preconditions instead of if
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/6804799e
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/6804799e
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/6804799e
Branch: refs/heads/master
Commit: 6804799eb4936029728862c194d3dd8f45a6d080
Parents: f4f044f
Author: Benoit Tellier <bt...@linagora.com>
Authored: Thu Oct 27 17:15:09 2016 +0200
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Fri Nov 18 18:46:46 2016 +0700
----------------------------------------------------------------------
.../james/transport/mailets/delivery/SieveMailet.java | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/6804799e/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/delivery/SieveMailet.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/delivery/SieveMailet.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/delivery/SieveMailet.java
index 1eaa6e6..69026f9 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/delivery/SieveMailet.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/delivery/SieveMailet.java
@@ -51,6 +51,7 @@ import org.apache.mailet.base.GenericMailet;
import org.apache.mailet.base.RFC2822Headers;
import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
/**
* Contains resource bindings.
@@ -178,14 +179,8 @@ public class SieveMailet extends GenericMailet {
}
public void storeMail(MailAddress sender, MailAddress recipient, Mail mail) throws MessagingException {
- if (recipient == null) {
- throw new IllegalArgumentException(
- "Recipient for mail to be spooled cannot be null.");
- }
- if (mail.getMessage() == null) {
- throw new IllegalArgumentException(
- "Mail message to be spooled cannot be null.");
- }
+ Preconditions.checkNotNull(recipient, "Recipient for mail to be spooled cannot be null.");
+ Preconditions.checkNotNull(mail.getMessage(), "Mail message to be spooled cannot be null.");
sieveMessage(recipient, mail);
// If no exception was thrown the message was successfully stored in the mailbox
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org