[prev in list] [next in list] [prev in thread] [next in thread]
List: james-dev
Subject: [5/9] james-project git commit: MAILBOX-321 More functional code for MessageParser::isTextPart
From: aduprat () apache ! org
Date: 2017-11-30 14:22:25
Message-ID: b56c84992a4f4f40b2b1afd7dfb1b572 () git ! apache ! org
[Download RAW message or body]
MAILBOX-321 More functional code for MessageParser::isTextPart
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/4189dda8
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/4189dda8
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/4189dda8
Branch: refs/heads/master
Commit: 4189dda8eb9f7e340413b54e2d76ddfb77bff5d7
Parents: b292d37
Author: benwa <btellier@linagora.com>
Authored: Tue Nov 28 10:31:34 2017 +0700
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Thu Nov 30 14:54:09 2017 +0100
----------------------------------------------------------------------
.../mailbox/store/mail/model/impl/MessageParser.java | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/4189dda8/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 c6b6b56..5494e29 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
@@ -205,14 +205,10 @@ public class MessageParser {
}
private boolean isTextPart(Entity part) {
- Optional<ContentTypeField> contentTypeField = getContentTypeField(part);
- if (contentTypeField.isPresent()) {
- String mediaType = contentTypeField.get().getMediaType();
- if (mediaType != null && mediaType.equals(TEXT_MEDIA_TYPE)) {
- return true;
- }
- }
- return false;
+ return getContentTypeField(part)
+ .map(ContentTypeField::getMediaType)
+ .map(TEXT_MEDIA_TYPE::equals)
+ .orElse(false);
}
private byte[] getBytes(Body body) throws IOException {
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic