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 pg...@apache.org on 2002/08/06 05:16:49 UTC
cvs commit: jakarta-james/src/java/org/apache/james/transport/mailets Redirect.java
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%"><prefix></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%"><static></TD>
@@ -165,7 +165,8 @@
*<inline>unaltered</inline><BR>
*<passThrough>FALSE</passThrough><BR>
*<replyto>postmaster</replyto><BR>
-*<prefix>[test mailing]</prefix><BR>
++*<prefix xml:space="preserve">[test mailing] </prefix><BR>
++*<!-- note the xml:space="preserve" to preserve whitespace --><BR>
*<static>TRUE</static><BR>
*<passThrough>FALSE</passThrough><BR>
*</mailet><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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>