james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vince...@apache.org
Subject cvs commit: james-server/src/java/org/apache/james/transport/mailets AbstractNotify.java
Date Tue, 14 Oct 2003 16:49:17 GMT
vincenzo    2003/10/14 09:49:17

  Modified:    src/java/org/apache/james/transport/mailets
                        AbstractNotify.java
  Log:
  getSender() was not properly managing special addresses such as "SENDER" or "UNALTERED".
  
  Revision  Changes    Path
  1.10      +24 -7     james-server/src/java/org/apache/james/transport/mailets/AbstractNotify.java
  
  Index: AbstractNotify.java
  ===================================================================
  RCS file: /home/cvs/james-server/src/java/org/apache/james/transport/mailets/AbstractNotify.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractNotify.java	4 Jul 2003 16:46:11 -0000	1.9
  +++ AbstractNotify.java	14 Oct 2003 16:49:17 -0000	1.10
  @@ -268,16 +268,33 @@
        * @return the value of the <CODE>sendingAddress</CODE> init parameter,
        * or the value of the <CODE>sender</CODE> init parameter if missing,
        * or the postmaster address if both are missing
  +     * @return the <CODE>sendingAddress</CODE> init parameter
  +     * or the <CODE>sender</CODE> init parameter
  +     * or the postmaster address if both are missing;
  +     * possible special addresses returned are
  +     * <CODE>SpecialAddress.SENDER</CODE>
  +     * and <CODE>SpecialAddress.UNALTERED</CODE>
        */
       protected MailAddress getSender() throws MessagingException {
  -        if (getInitParameter("sendingAddress") == null) {
  -            if (getInitParameter("sender") == null) {
  +        String addressString = getInitParameter("sendingAddress");
  +        
  +        if (addressString == null) {
  +            addressString = getInitParameter("sender");
  +            if (addressString == null) {
                   return getMailetContext().getPostmaster();
  -            } else {
  -                return new MailAddress(getInitParameter("sender"));
               }
  -        } else {
  -            return new MailAddress(getInitParameter("sendingAddress"));
  +        }
  +        
  +        MailAddress specialAddress = getSpecialAddress(addressString,
  +                                        new String[] {"postmaster", "sender", "unaltered"});
  +        if (specialAddress != null) {
  +            return specialAddress;
  +        }
  +
  +        try {
  +            return new MailAddress(addressString);
  +        } catch(Exception e) {
  +            throw new MessagingException("Exception thrown in getSender() parsing: " +
addressString, e);
           }
       }
   
  
  
  

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