james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pgoldst...@apache.org
Subject cvs commit: jakarta-james/src/java/org/apache/james/transport/mailets Redirect.java
Date Tue, 06 Aug 2002 03:16:49 GMT
pgoldstein    2002/08/05 20:16:49

  Modified:    src/java/org/apache/james/transport/mailets Redirect.java
  Log:
  An bugfix to the Redirect mailet that addresses potential issues with
  the subject prefix.  The mailet now contains instructions for configuring
  the mailet for preserving whitespace in the prefix.
  
  Thanks to Noel Bergman for this submission.
  
  Revision  Changes    Path
  1.6       +23 -19    jakarta-james/src/java/org/apache/james/transport/mailets/Redirect.java
  
  Index: Redirect.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/Redirect.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Redirect.java	28 Jul 2002 11:46:41 -0000	1.5
  +++ Redirect.java	6 Aug 2002 03:16:49 -0000	1.6
  @@ -137,8 +137,8 @@
   *<TR>
   *<TD width="20%">&lt;prefix&gt;</TD>
   *<TD width="80%">An optional subject prefix prepended to the original message
  -*subject, for example..<BR>
  -*Undeliverable mail:</TD>
  ++*subject, for example:<BR>
  ++*Undeliverable mail: </TD>
   *</TR>
   *<TR>
   *<TD width="20%">&lt;static&gt;</TD>
  @@ -165,7 +165,8 @@
   *&lt;inline&gt;unaltered&lt;/inline&gt;<BR>
   *&lt;passThrough&gt;FALSE&lt;/passThrough&gt;<BR>
   *&lt;replyto&gt;postmaster&lt;/replyto&gt;<BR>
  -*&lt;prefix&gt;[test mailing]&lt;/prefix&gt;<BR>
  ++*&lt;prefix xml:space="preserve"&gt;[test mailing] &lt;/prefix&gt;<BR>
  ++*&lt;!-- note the xml:space="preserve" to preserve whitespace --&gt;<BR>
   *&lt;static&gt;TRUE&lt;/static&gt;<BR>
   *&lt;passThrough&gt;FALSE&lt;/passThrough&gt;<BR>
   *&lt;/mailet&gt;<BR>
  @@ -353,13 +354,13 @@
       }
   
       /**
  -* return a prefix for the message subject
  -*/
  +     * return a prefix for the message subject
  +     */
       public String getSubjectPrefix() {
           if(getInitParameter("prefix") == null) {
               return "";
           } else {
  -            return getInitParameter("prefix") + " ";
  +            return getInitParameter("prefix");
           }
       }
   
  @@ -410,13 +411,15 @@
               messageText  = getMessage();
               recipients   = getRecipients();
               apparentlyTo = getTo();
  -            StringBuffer logBuffer = new StringBuffer("static, sender=");
  -            logBuffer.append(sender);
  -            logBuffer.append(", replyTo=");
  -            logBuffer.append(replyTo);
  -            logBuffer.append(", message=");
  -            logBuffer.append(messageText);
  -            logBuffer.append(" ");
  +            StringBuffer logBuffer =
  +                new StringBuffer(1024)
  +                        .append("static, sender=")
  +                        .append(sender)
  +                        .append(", replyTo=")
  +                        .append(replyTo)
  +                        .append(", message=")
  +                        .append(messageText)
  +                        .append(" ");
               log(logBuffer.toString());
           }
       }
  @@ -445,10 +448,9 @@
               PrintWriter out   = new PrintWriter(sout, true);
               Enumeration heads = message.getAllHeaderLines();
               String head       = "";
  -            StringBuffer headBuffer = new StringBuffer();
  +            StringBuffer headBuffer = new StringBuffer(1024);
               while(heads.hasMoreElements()) {
  -                headBuffer.append(heads.nextElement().toString());
  -                headBuffer.append("\n");
  +                headBuffer.append(heads.nextElement().toString()).append("\n");
               }
               head = headBuffer.toString();
               boolean all = false;
  @@ -496,9 +498,11 @@
                           }
                           break;
                       case ALL: //ALL:
  -                        StringBuffer textBuffer = new StringBuffer(head);
  -                        textBuffer.append("\n\n");
  -                        textBuffer.append(message.toString());
  +                        StringBuffer textBuffer =
  +                            new StringBuffer(1024)
  +                                .append(head)
  +                                .append("\n\n")
  +                                .append(message.toString());
                           part.setText(textBuffer.toString());
                           break;
                       case MESSAGE: //MESSAGE:
  
  
  

--
To unsubscribe, e-mail:   <mailto:james-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@jakarta.apache.org>


Mime
View raw message