You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/05/18 14:24:15 UTC
[james-project] 03/07: [PERFORMANCE]
MessageViewFactory::toHeaderMap was unfolding headers twice
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit c3031a78b63442cce4cff0b5224b016872d5aa56
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun May 16 14:09:07 2021 +0700
[PERFORMANCE] MessageViewFactory::toHeaderMap was unfolding headers twice
Field::getBody already perform the operation hence there is
no need for it. Async-profiler indicates we spend 0.2% of
the CPU needlessly that way... Minor but always good to take!
---
.../james/jmap/draft/model/message/view/MessageViewFactory.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/message/view/MessageViewFactory.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/message/view/MessageViewFactory.java
index a62fe02..d0c3e78 100644
--- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/message/view/MessageViewFactory.java
+++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/message/view/MessageViewFactory.java
@@ -39,10 +39,11 @@ import org.apache.james.mailbox.MailboxSession;
import org.apache.james.mailbox.model.MailboxId;
import org.apache.james.mailbox.model.MessageId;
import org.apache.james.mailbox.model.MessageResult;
+import org.apache.james.mime4j.codec.DecodeMonitor;
+import org.apache.james.mime4j.codec.DecoderUtil;
import org.apache.james.mime4j.dom.Message;
import org.apache.james.mime4j.stream.Field;
import org.apache.james.mime4j.stream.MimeConfig;
-import org.apache.james.mime4j.util.MimeUtil;
import org.apache.james.util.ReactorUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -111,7 +112,7 @@ public interface MessageViewFactory<T extends MessageView> {
Function<Map.Entry<String, Collection<Field>>, String> bodyConcatenator = fieldListEntry -> fieldListEntry.getValue()
.stream()
.map(Field::getBody)
- .map(MimeUtil::unscrambleHeaderValue)
+ .map(body -> DecoderUtil.decodeEncodedWords(body, DecodeMonitor.SILENT))
.collect(Collectors.toList())
.stream()
.collect(Collectors.joining(JMAP_MULTIVALUED_FIELD_DELIMITER));
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org