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 bt...@apache.org on 2019/11/18 02:51:00 UTC

[james-project] 26/44: [Refactoring] MimeDescriptorImpl: Move isComposite to MessageResultImpl

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 ad5f84de6aa16acf85520d8dd29c3fbc4cef7e1e
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu Nov 14 11:32:57 2019 +0700

    [Refactoring] MimeDescriptorImpl: Move isComposite to MessageResultImpl
---
 .../org/apache/james/mailbox/store/MessageResultImpl.java  | 14 +++++++++++++-
 .../org/apache/james/mailbox/store/MimeDescriptorImpl.java | 12 ------------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java
index 4fcc707..fb3b9cb 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java
@@ -279,7 +279,7 @@ public class MessageResultImpl implements MessageResult {
         // it can be relative expensive on big messages and slow mailbox implementations
         if (mimeDescriptor == null) {
             try {
-                if (MimeDescriptorImpl.isComposite(message.getMediaType())) {
+                if (isComposite(message.getMediaType())) {
                     mimeDescriptor = MimeDescriptorImpl.build(getFullContent().getInputStream());
                 } else {
                     mimeDescriptor = new LazyMimeDescriptor(this, message);
@@ -290,6 +290,18 @@ public class MessageResultImpl implements MessageResult {
         }
         return mimeDescriptor;
     }
+
+    /**
+     * Is this a composite media type (as per RFC2045)?
+     *
+     * TODO: Move to Mime4j
+     * @param mediaType possibly null
+     * @return true when the type is composite,
+     * false otherwise
+     */
+    private boolean isComposite(String mediaType) {
+        return "message".equalsIgnoreCase(mediaType) || "multipart".equalsIgnoreCase(mediaType);
+    }
     
     @Override
     public Headers getHeaders() {
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java
index a06e7ef..4c43e1f 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java
@@ -45,18 +45,6 @@ import org.apache.james.mime4j.stream.RecursionMode;
 
 public class MimeDescriptorImpl implements MimeDescriptor {
 
-    /**
-     * Is this a composite media type (as per RFC2045)?
-     * 
-     * TODO: Move to Mime4j
-     * @param mediaType possibly null
-     * @return true when the type is composite,
-     * false otherwise
-     */
-    public static boolean isComposite(String mediaType) {
-        return "message".equalsIgnoreCase(mediaType) || "multipart".equalsIgnoreCase(mediaType);
-    }
-
     public static MimeDescriptorImpl build(InputStream stream) throws IOException, MimeException {
         // Disable line length limit
         // See https://issues.apache.org/jira/browse/IMAP-132


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org