james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rouaz...@apache.org
Subject [46/50] [abbrv] james-project git commit: MAILET-155 Improve style of MailMessageAlteringUtils
Date Wed, 11 Jan 2017 09:26:34 GMT
MAILET-155 Improve style of MailMessageAlteringUtils


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

Branch: refs/heads/master
Commit: b43cb05a9ae842eaca6a55e3ec6badf0005a25fb
Parents: 2bf9780
Author: Benoit Tellier <btellier@linagora.com>
Authored: Wed Jan 11 10:29:23 2017 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Wed Jan 11 11:02:03 2017 +0700

----------------------------------------------------------------------
 .../redirect/MailMessageAlteringUtils.java       | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/b43cb05a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/MailMessageAlteringUtils.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/MailMessageAlteringUtils.java
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/MailMessageAlteringUtils.java
index f040e90..978c0b4 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/MailMessageAlteringUtils.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/MailMessageAlteringUtils.java
@@ -197,14 +197,14 @@ public class MailMessageAlteringUtils {
         }
         switch (mailet.getInitParameters().getInLineType()) {
             case ALL:
-                appendHead(builder, head);
-                appendBody(builder, originalMessage);
+                builder.append(headText(head));
+                builder.append(bodyText(originalMessage));
                 break;
             case HEADS:
-                appendHead(builder, head);
+                builder.append(headText(head));
                 break;
             case BODY:
-                appendBody(builder, originalMessage);
+                builder.append(bodyText(originalMessage));
                 break;
             case NONE:
                 break;
@@ -216,14 +216,12 @@ public class MailMessageAlteringUtils {
         return builder.toString();
     }
 
-    private void appendHead(StringBuilder builder, String head) {
-        builder.append("Message Headers:")
-            .append(LINE_BREAK)
-            .append(head)
-            .append(LINE_BREAK);
+    private String headText(String head) {
+        return "Message Headers:" + LINE_BREAK + head + LINE_BREAK;
     }
 
-    private void appendBody(StringBuilder builder, MimeMessage originalMessage) {
+    private String bodyText(MimeMessage originalMessage) {
+        StringBuilder builder = new StringBuilder();
         builder.append("Message:")
             .append(LINE_BREAK);
         try {
@@ -233,6 +231,7 @@ public class MailMessageAlteringUtils {
             builder.append("body unavailable")
                 .append(LINE_BREAK);
         }
+        return builder.toString();
     }
 
     /**


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