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/10/04 07:03:29 UTC
cvs commit: jakarta-james/src/java/org/apache/james/transport/mailets Redirect.java ToProcessor.java UseHeaderRecipients.java
pgoldstein 2002/10/03 22:03:29
Modified: src/java/org/apache/james/transport/mailets Redirect.java
ToProcessor.java UseHeaderRecipients.java
Log:
Making debug values configurable.
Thanks to Noel Bergman
Revision Changes Path
1.17 +6 -5 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.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Redirect.java 2 Oct 2002 07:27:44 -0000 1.16
+++ Redirect.java 4 Oct 2002 05:03:28 -0000 1.17
@@ -198,7 +198,7 @@
/**
* Controls certain log messages
*/
- private final boolean DEBUG = false;
+ private boolean isDebug = false;
// The values that indicate how to attach the original mail
// to the redirected mail.
@@ -424,16 +424,17 @@
*
*/
public void init() throws MessagingException {
- if (DEBUG) {
+ if (isDebug) {
log("Redirect init");
}
+ isDebug = (getInitParameter("debug") == null) ? false : new Boolean(getInitParameter("debug")).booleanValue();
if(isStatic()) {
sender = getSender();
replyTo = getReplyTo();
messageText = getMessage();
recipients = getRecipients();
apparentlyTo = getTo();
- if (DEBUG) {
+ if (isDebug) {
StringBuffer logBuffer =
new StringBuffer(1024)
.append("static, sender=")
@@ -467,7 +468,7 @@
MimeMessage reply = null;
//Create the message
if(getInLineType() != UNALTERED) {
- if (DEBUG) {
+ if (isDebug) {
log("Alter message inline=:" + getInLineType());
}
reply = new MimeMessage(Session.getDefaultInstance(System.getProperties(),
@@ -546,7 +547,7 @@
} else {
// if we need the original, create a copy of this message to redirect
reply = getPassThrough() ? new MimeMessage(message) : message;
- if (DEBUG) {
+ if (isDebug) {
log("Message resent unaltered.");
}
}
1.7 +3 -2 jakarta-james/src/java/org/apache/james/transport/mailets/ToProcessor.java
Index: ToProcessor.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/ToProcessor.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ToProcessor.java 2 Oct 2002 07:27:44 -0000 1.6
+++ ToProcessor.java 4 Oct 2002 05:03:28 -0000 1.7
@@ -30,7 +30,7 @@
/**
* Controls certain log messages
*/
- private final boolean DEBUG = false;
+ private boolean isDebug = false;
/**
* The name of the processor to which this mailet forwards mail
@@ -48,6 +48,7 @@
* @throws MailetException if the processor parameter is missing
*/
public void init() throws MailetException {
+ isDebug = (getInitParameter("debug") == null) ? false : new Boolean(getInitParameter("debug")).booleanValue();
processor = getInitParameter("processor");
if (processor == null) {
throw new MailetException("processor parameter is required");
@@ -63,7 +64,7 @@
* @throws MessagingException in all cases
*/
public void service(Mail mail) throws MessagingException {
- if (DEBUG) {
+ if (isDebug) {
StringBuffer logBuffer =
new StringBuffer(128)
.append("Sending mail ")
1.6 +13 -4 jakarta-james/src/java/org/apache/james/transport/mailets/UseHeaderRecipients.java
Index: UseHeaderRecipients.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/UseHeaderRecipients.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UseHeaderRecipients.java 2 Oct 2002 07:27:44 -0000 1.5
+++ UseHeaderRecipients.java 4 Oct 2002 05:03:29 -0000 1.6
@@ -46,7 +46,16 @@
/**
* Controls certain log messages
*/
- private final boolean DEBUG = false;
+ private boolean isDebug = false;
+
+ /**
+ * Initialize the mailet
+ *
+ * initializes the DEBUG flag
+ */
+ public void init() {
+ isDebug = (getInitParameter("debug") == null) ? false : new Boolean(getInitParameter("debug")).booleanValue();
+ }
/**
* Process an incoming email, removing the currently identified
@@ -70,7 +79,7 @@
recipients.addAll(getHeaderMailAddresses(message, "To"));
recipients.addAll(getHeaderMailAddresses(message, "Cc"));
}
- if (DEBUG) {
+ if (isDebug) {
log("All recipients = " + recipients.toString());
log("Reprocessing mail using recipients in message headers");
}
@@ -100,7 +109,7 @@
*/
private Collection getHeaderMailAddresses(MimeMessage message, String name) throws MessagingException {
- if (DEBUG) {
+ if (isDebug) {
StringBuffer logBuffer =
new StringBuffer(64)
.append("Checking ")
@@ -118,7 +127,7 @@
while (st.hasMoreTokens()) {
addressString = st.nextToken();
iAddress = new InternetAddress(addressString);
- if (DEBUG) {
+ if (isDebug) {
log("Address = " + iAddress.toString());
}
addresses.add(new MailAddress(iAddress));
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>