james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [4/5] james-project git commit: MAILBOX-288 Removing all MIME4J limitations while searching messages (raw search)
Date Tue, 28 Feb 2017 09:40:29 GMT
MAILBOX-288 Removing all MIME4J limitations while searching messages (raw search)


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

Branch: refs/heads/master
Commit: 3602b25d9abae4856cdebb380017f90f20380f53
Parents: 746f2a5
Author: benwa <btellier@linagora.com>
Authored: Mon Feb 27 15:15:48 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Tue Feb 28 16:39:07 2017 +0700

----------------------------------------------------------------------
 .../james/mailbox/store/search/MessageSearches.java    | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/3602b25d/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java
index 6edd1af..3cab0fd 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java
@@ -66,6 +66,7 @@ import org.apache.james.mime4j.field.datetime.parser.ParseException;
 import org.apache.james.mime4j.message.DefaultMessageBuilder;
 import org.apache.james.mime4j.message.DefaultMessageWriter;
 import org.apache.james.mime4j.message.HeaderImpl;
+import org.apache.james.mime4j.stream.MimeConfig;
 import org.apache.james.mime4j.utils.search.MessageMatcher;
 
 import com.google.common.base.Function;
@@ -79,6 +80,14 @@ import com.google.common.collect.Lists;
  */
 public class MessageSearches implements Iterable<SimpleMessageSearchIndex.SearchResult>
{
 
+    private static final MimeConfig MIME_ENTITY_CONFIG = MimeConfig.custom()
+        .setMaxContentLen(-1)
+        .setMaxHeaderCount(-1)
+        .setMaxHeaderLen(-1)
+        .setMaxHeaderCount(-1)
+        .setMaxLineLen(-1)
+        .build();
+
     private Iterator<MailboxMessage> messages;
     private SearchQuery query;
     private MailboxSession session;
@@ -254,7 +263,9 @@ public class MessageSearches implements Iterable<SimpleMessageSearchIndex.Search
     }
 
     private HeaderImpl buildTextHeaders(MailboxMessage message) throws IOException, MimeIOException
{
-        Message headersMessage = new DefaultMessageBuilder()
+        DefaultMessageBuilder defaultMessageBuilder = new DefaultMessageBuilder();
+        defaultMessageBuilder.setMimeEntityConfig(MIME_ENTITY_CONFIG);
+        Message headersMessage = defaultMessageBuilder
             .parseMessage(message.getHeaderContent());
         HeaderImpl headerImpl = new HeaderImpl();
         addFrom(headerImpl, headersMessage.getFrom());


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