MAILBOX-321 Simplify CID handling
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/b292d37c Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/b292d37c Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/b292d37c Branch: refs/heads/master Commit: b292d37c36539bec9529f088a8f9f26e7e5bbc1b Parents: c034bc4 Author: benwa <btell...@linagora.com> Authored: Tue Nov 28 10:27:03 2017 +0700 Committer: Antoine Duprat <adup...@linagora.com> Committed: Thu Nov 30 14:54:09 2017 +0100 ---------------------------------------------------------------------- .../mailbox/store/mail/model/impl/MessageParser.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/b292d37c/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/MessageParser.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/MessageParser.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/MessageParser.java index 785c894..c6b6b56 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/MessageParser.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/MessageParser.java @@ -25,7 +25,6 @@ import java.io.InputStream; import java.util.List; import java.util.Locale; import java.util.Optional; -import java.util.function.Function; import java.util.stream.Stream; import org.apache.james.mailbox.model.Attachment; @@ -182,15 +181,8 @@ public class MessageParser { } private Optional<Cid> cid(Optional<ContentIdField> contentIdField) { - if (!contentIdField.isPresent()) { - return Optional.empty(); - } - return contentIdField.map(toCid()) - .get(); - } - - private Function<ContentIdField, Optional<Cid>> toCid() { - return contentIdField -> cidParser.parse(contentIdField.getId()); + return contentIdField.map(ContentIdField::getId) + .flatMap(cidParser::parse); } private boolean isMultipart(Entity entity) { --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org